我使用SharePoint 2013 ECM上傳新的文檔集到列表中編程VB.NET/C#的Sharepoint 2013如何將屬性添加到文檔集
我成功地創建文檔集,但不能找到關於如何將屬性/元數據添加到上傳的文檔集的任何文檔。文檔集將上傳到的文件夾已經具有預定義的屬性。我只需要設置它們。
下面的代碼創建新的文檔集。但是我可以在互聯網上找到關於如何添加屬性的零信息。 Sharepoint 2010庫允許DocumentSet.Create包含一個屬性字段,但似乎並不是2013。
Dim context As ClientContext = New ClientContext("URL")
context.Credentials = New NetworkCredential("Username", "Password")
'Get the document library in which the document set has to be created
Dim list As List = context.Web.Lists.GetById(New Guid("dc9e7aa5-5ac3-499c-a967-fa8f04bf1c90"))
'Get the parent folder where the document set has to be created
Dim parentFolder As Folder = list.RootFolder
'Get the "Document Set" content type by id (Document Set content type Id : 0x0120D520) for the document library
Dim ct As ContentType = context.Web.ContentTypes.GetById("0x0120D520")
context.Load(ct)
context.ExecuteQuery()
'Create a new document set
'A new document set will be created in "Documents" library as "Test Document" under which you can add the documents
DocumentSet.Create(context, parentFolder, dsName, ct.Id)
context.ExecuteQuery()
我收到錯誤消息:「Column'App No'不存在,它可能已被其他用戶刪除。」有什麼建議麼? – Cyassin
可能發生這種錯誤,因爲提供的列名稱'App No'對應於它的顯示名稱,但是'ListItemAllFields'預計字段內部名稱,所以嘗試指定其內部名稱 –
感謝Vadim, 我沒有訪問內部名稱我在週末沒有與客戶溝通的地點工作,也無法訪問這些信息。 我能夠使用folder.Properties.Item(「App No」)=「blah」來解析。只是試圖理解爲什麼工作,該方法是否接受顯示名稱? 非常感謝能夠讓我完成項目的其他代碼。 – Cyassin