Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to Update List Document Properties.

  Asked By: Nichole    Date: Oct 19    Category: Sharepoint    Views: 2285

I need a code to update the Document list Items properties.
I have the code to move a file from one site to another, but I want to
keep the last modify attributes in the new site list. any help?



1 Answer Found

Answer #1    Answered By: Ruth George     Answered On: Oct 19

Hope this portion of code  make sense to you.

SPFileCollection ospDestFiles = CreateSPWeb(destURL).Folders[docLibraryFolder].Files;
SPFile ospFile = GetSPFile(getSourceURL(), getSourceFilePath());
byte[] sourceFileContents = ospFile.OpenBinary();
SPFile ospFile2 = ospDestFiles.Add(destURL+folderPath,sourceFileContents,true);

((SPListItem)ospFile2.Item)["Reason"] = reasonTextArea.Text;
((SPListItem)ospFile2.Item)["Summary"] = summaryTextArea.Text;
((SPListItem)ospFile2.Item)["Owner"] = fileUserList.SelectedValue;
((SPListItem)ospFile2.Item)["Modified"] = dt;

Didn't find what you were looking for? Find more on How to Update List Document Properties. Or get search suggestion and latest updates.