1

Sharepoint Online context;

I've read lots os posts and the class reference and seems it's not possible, so I want to confirm if is it not possible to set List GUID when adding to SP.ListCollection (REST or JSOM or SPO Powershell)?

We are provisioning SP.ClientContext.get_current().web.get_fields().addFieldAsXml() dozens of lookup Site Fields, and they are bound to (test collection) List's GUID.

Any ideas?

Thank u

1

You can't specify the GUID of a list when creating it, that would also very easily result in having multiple lists with same GUID, which would confuse SharePoint.

But you can specify the "Url" of the parent list instead of the Guid when creating a lookup column.

Like:

<Field ID="{2FF1B484-6D70-449c-8E5C-904E4D5971E1}" Name="Leader" Group="My Custom Columns" Type="Lookup" DisplayName="Leader" List="Lists/Leaders" ShowField="Title" PrependId="TRUE"/>
| improve this answer | |
  • From msdn.microsoft.com/en-us/library/office/aa979575.aspx : List: Optional Text; if the target list already exists, the value of the List attribute should be the string representation of the GUID that identifies the target list. If the target list does not yet exist, the value of the List attribute can be a web-relative URL such as "Lists/My List" but only if the target list is created in the same feature as the one that creates the lookup field. It's a valid approach but in my case it's all created using CSOM/REST, so I think it won't work, but thank you anyway, – egidiocs Feb 29 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.