Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在上载到SharePoint文档库的文档上附加多个元数据标记_C#_Sharepoint 2010_Sharepoint 2013_Sharepointdocumentlibrary - Fatal编程技术网

C# 在上载到SharePoint文档库的文档上附加多个元数据标记

C# 在上载到SharePoint文档库的文档上附加多个元数据标记,c#,sharepoint-2010,sharepoint-2013,sharepointdocumentlibrary,C#,Sharepoint 2010,Sharepoint 2013,Sharepointdocumentlibrary,我能够轻松地将文档添加到站点。我能够填写文档库中的一列,而且只能填写其中一列。我希望能够在选择中添加多个。它仅添加复选框列表中的最后一个。我想向文档中添加多个元数据标记。我已将文档库配置为接受列中的多个标记 if (FU1.PostedFile != null) { if (FU1.PostedFile.ContentLength > 0) {

我能够轻松地将文档添加到站点。我能够填写文档库中的一列,而且只能填写其中一列。我希望能够在选择中添加多个。它仅添加复选框列表中的最后一个。我想向文档中添加多个元数据标记。我已将文档库配置为接受列中的多个标记

if (FU1.PostedFile != null)   
                {    
                if (FU1.PostedFile.ContentLength > 0)     
                {   
                    Stream fileStream = FU1.PostedFile.InputStream;      
                    byte[] byt = new       byte[Convert.ToInt32(FU1.PostedFile.ContentLength)];   
                    fileStream.Read(byt, 0,       Convert.ToInt32(FU1.PostedFile.ContentLength));    

                    fileStream.Close();     

                    using (SPSite site = new SPSite(SPContext.Current.Site.Url))    

                    {   
                        using (SPWeb webcollection = site.OpenWeb())   
                        {      
                            SPFolder myfolder = webcollection.Folders["collecteddocuments"];   
                            webcollection.AllowUnsafeUpdates = true;   
                            SPFile file = myfolder.Files.Add(System.IO.Path.GetFileName(FU1.PostedFile.FileName), byt);
                            SPListItem item = file.Item;
                            //StringBuilder sb = new StringBuilder();
                            //int metadataCount = this.CblDocumentMetadata.Items.Count;
                            //int count = 0;
                            foreach (var q in this.CblDocumentMetadata.Items)
                            {
                                item["Document Type"] = q.ToString();

                            }
                            item.Update();
                        }
                    }
                }
            }

根据您的代码,看起来您正在为CblDocumentMetadata中的每个项目设置“文档类型”,最后一个将是最后一个设置的项目

我真的不清楚你到底想在这里做什么。也许你可以编辑你的问题来澄清