คำถาม One file uploading with lookup field results two history versions using client object model

  • 31 พฤษภาคม 2555 7:19
     
     

    Hello experts,

    I am recently working with sharepoint client object model to upload file to sharepoint  server365.

    I have been stuck by the issue that one file uploading results two versions on sharepoint. Please reference to the following code piece.

    Any hint or answer is appreciated.Thanks in advance.

            public void SaveFile()

           {

               ClientContext ctx = new ClientContext ("url")

               File file;

                ....

                // Get file

                ....

               UpdateProperties(file.List,ctx);

                FileSaveBinaryInformation fsbi = new FileSaveBinaryInformation();
                fsbi.Content = Doc.GetBytes();
                file.CheckIn("comment", CheckInType.MinorCheckIn);

                // Save file
                //
                file.SaveBinary(fsbi);

    }

            private void UpdateProperties(ListItem item,ClientContext CTX)
            {
                       // Update other properties
                        FieldLookupValue fvalue = new FieldLookupValue();
                        CTX.Load(spitem.Tag);
                        CTX.ExecuteQuery();
                        fvalue.LookupId = spitem.Tag.Id;
                        item["Customer"] = fvalue;// Lookup field
                        item.Update();// must call Update method. Otherwise, it will not be updated on sharepoint. Why? 
                    }
                }
                item["FileLeafRef"] = this.tb_name.Text;
            }


    eddy hu

ตอบทั้งหมด

  • 11 มิถุนายน 2555 17:54
    ผู้ดูแล
     
     

    Hi,

    Unfortunately, your question has been posted in the incorrect area. If you are using the cloud based version of SharePoint 2010 with Office 365, you will want to post your question in the Office 365 forums. If you are using an on-premise install of SharePoint server 2010, you will want to post your question in the SharePoint 2010 forums.

    Thanks,

    Tim Muth
    Microsoft Online Services Technical Support