When adding custom Document Sets to sharepoint shared documents programmatically, how do I assign one of the custom field value?
Hashtable docProps = new Hashtable();
docProps.Add("Field1", myvalue);
docProps.Add("Field2", "slsl");
docProps.Add("Field3", "wwowowo");
try
{
DocumentSet ds = DocumentSet.Create(list.RootFolder, "mydocumentset", list.ContentTypes["CustomDocumentSet"].Id, docProps);
}
This will add the document set, but开发者_StackOverflow中文版 value of the hashtalbe is not being accepted.
I had the same question and this is how I solved it. Basically we are referring to a wrong name. You can find teh correct property name by looping through the fieldlinks in the contentType. DocumentSet docSet = DocumentSet.Create(parentFolder, DocumentSetName, docsetCT.Id, properties,true);
put a quick watch on below and see teh property names by looping through the fieldlinks.
docSet.ContentType.FieldLinks[0]
I hope it solves your problem. I spent quite some time on this.
Regards Abir
you are missing some input parameters for the create method.
http://msdn.microsoft.com/en-us/library/ee588760.aspx
精彩评论