Use unique values ​​for an external data type column in sharepoint

Use unique values ​​for an external data type column. I know this is not possible out of the box. What are soultions for checking columns of an external data type for duplicates? work processes? others?

+4
source share
2 answers

Well, external lists cannot have workflows or event receivers where you can validate the data, so doing this in SharePoint will actually be very difficult. My opinion is that you should check your data before importing into SP. If your data source is a database, then add a constraint if it is a web service, then the external system should provide uniqueness if it is a custom external content type that you can force to execute using code.

0
source

Although this is not mentioned in the MS documentation, you can use the uniqueness in the "External Data" type column using PowerShell. I just tried the example below and it works on the SP2013 farm.

https://msdn.microsoft.com/en-us/library/office/ee536168%28v=office.14%29.aspx?f=255&MSPPError=-2147217396

Example from Office DEV Center

SPSite site = new SPSite("http://localhost"); SPWeb web = site.OpenWeb(); SPList custList = web.Lists["Customers"]; SPField custPhone = custList.Fields["Phone Number"]; custPhone.Indexed = true; custPhone.EnforceUniqueValues = true; /// You must call the Update() method /// when you change the EnforceUniqueValues property custPhone.Update(); 
0
source

Source: https://habr.com/ru/post/1369630/


All Articles