I am updating RefCreated column in sharepoint list when new item is getting created. Problem is if 7 items are already there and 8th item is added by user all RefCreated field of items will get updated by that user. I want to update only current newly added item. I am using below code.

uploadFile = uploadFile.FinishUpload(uploadId, fileoffset, s);
ListItemCollection items = docs.GetItems(CamlQuery.CreateAllItemsQuery());
User currentUser = ctx.Web.CurrentUser;
Logger.Info("valueD" + currentUser);
foreach (var item in items)
     item["RefCreated"] = toaddress;
     //item["ReferenceCreated"] = toaddress;

  • 1
    From the code you posted it seems that you are updating for all items using for each loop. You will need to write code in such a way that it will get only created item and do the updation for that item only – P S Feb 12 at 10:11
  • yes, can you help me with that – Brishal Feb 12 at 10:12
  • Hi Brishal, you will need to add more detail to your question and if possible your full code. – P S Feb 12 at 10:16
  • I have updated the code, we are uploading a new file every time code run and updating RefCreated field. but Refcreated field is getting updated for other previously added items as well. – Brishal Feb 12 at 10:25
  • Hi Brishal, google search "upload file with metadata using CSOM". You will get so many examples. – P S Feb 12 at 10:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.