سؤال

I need to create resources which might have custom fields. I've encountered the issue that, if the custom field is mandatory, then I get an exception after running context.ExecuteQuery();. This is my code:

resource.uid = Guid.NewGuid();
context.EnterpriseResources.Add(createNewEntityInformation(resource));
context.EnterpriseResources.Update();
context.ExecuteQuery();

And the method createNewEntityInformation is as follows:

EnterpriseResourceCreationInformation resourceInfo = new EnterpriseResourceCreationInformation();
resourceInfo.Id = Guid.NewGuid();
resourceInfo.Name = entity.name;
return resourceInfo;

I don't see any property in EnterpriseResourceCreationInformation, so how can I add the custom field values to the resource?

هل كانت مفيدة؟

المحلول

I solved this by disabling the mandatory requirement in all ECF prior to creating the resources, then after the creation I just re-enable them.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top