Skip to main content
added 1 character in body
Source Link
John John
  • 1
  • 49
  • 258
  • 603

I have the following code inside my RER:-

foreach (ListItem currentFilingSystemItem in collListItem)
    {
Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["DealName"].ToString());
context.Load(folder);
context.ExecuteQuery(); 
folder.MoveTo(context.Web.ServerRelativeUrl + "/ArchDocs/" + currentFilingSystemItem["DealName"].ToString());
folder.Update();

context.Load(folder);
context.Load(folder.Files);
context.Load(folder.Folders);
FileCollection files = folder.Files;
FolderCollection folders = folder.Folders;
context.ExecuteQuery();
foreach (File f in files)
  {
     ListItem item = f.ListItemAllFields;
     context.Load(item);
     context.ExecuteQuery();
     item["DealStage"] = currentFilingSystemItem["DealStage"];
     item.Update();
     context.ExecuteQuery();

  }
foreach (Folder fo in folders)
  {

      ListItem item = fo.ListItemAllFields;
      context.Load(item);
      context.ExecuteQuery();
      item["DealStage"] = currentFilingSystemItem["DealStage"];
      item.Update();
      context.ExecuteQuery();

  }

where i am trying to change a managed metadtametadata column named "DealStage" using this item["DealStage"] = currentFilingSystemItem["DealStage"]; for both File and Folders, but my above code will not raise any exception, but the DealStage will not get update! can anyone advice on this please? Thanks

I have the following code inside my RER:-

foreach (ListItem currentFilingSystemItem in collListItem)
    {
Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["DealName"].ToString());
context.Load(folder);
context.ExecuteQuery(); 
folder.MoveTo(context.Web.ServerRelativeUrl + "/ArchDocs/" + currentFilingSystemItem["DealName"].ToString());
folder.Update();

context.Load(folder);
context.Load(folder.Files);
context.Load(folder.Folders);
FileCollection files = folder.Files;
FolderCollection folders = folder.Folders;
context.ExecuteQuery();
foreach (File f in files)
  {
     ListItem item = f.ListItemAllFields;
     context.Load(item);
     context.ExecuteQuery();
     item["DealStage"] = currentFilingSystemItem["DealStage"];
     item.Update();
     context.ExecuteQuery();

  }
foreach (Folder fo in folders)
  {

      ListItem item = fo.ListItemAllFields;
      context.Load(item);
      context.ExecuteQuery();
      item["DealStage"] = currentFilingSystemItem["DealStage"];
      item.Update();
      context.ExecuteQuery();

  }

where i am trying to change a managed metadta column named "DealStage" using this item["DealStage"] = currentFilingSystemItem["DealStage"]; for both File and Folders, but my above code will not raise any exception, but the DealStage will not get update! can anyone advice on this please? Thanks

I have the following code inside my RER:-

foreach (ListItem currentFilingSystemItem in collListItem)
    {
Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["DealName"].ToString());
context.Load(folder);
context.ExecuteQuery(); 
folder.MoveTo(context.Web.ServerRelativeUrl + "/ArchDocs/" + currentFilingSystemItem["DealName"].ToString());
folder.Update();

context.Load(folder);
context.Load(folder.Files);
context.Load(folder.Folders);
FileCollection files = folder.Files;
FolderCollection folders = folder.Folders;
context.ExecuteQuery();
foreach (File f in files)
  {
     ListItem item = f.ListItemAllFields;
     context.Load(item);
     context.ExecuteQuery();
     item["DealStage"] = currentFilingSystemItem["DealStage"];
     item.Update();
     context.ExecuteQuery();

  }
foreach (Folder fo in folders)
  {

      ListItem item = fo.ListItemAllFields;
      context.Load(item);
      context.ExecuteQuery();
      item["DealStage"] = currentFilingSystemItem["DealStage"];
      item.Update();
      context.ExecuteQuery();

  }

where i am trying to change a managed metadata column named "DealStage" using this item["DealStage"] = currentFilingSystemItem["DealStage"]; for both File and Folders, but my above code will not raise any exception, but the DealStage will not get update! can anyone advice on this please? Thanks

Source Link
John John
  • 1
  • 49
  • 258
  • 603

Unable to change the managed metadata fields for my Files and Folders inside my remote event receiver

I have the following code inside my RER:-

foreach (ListItem currentFilingSystemItem in collListItem)
    {
Folder folder = context.Web.GetFolderByServerRelativeUrl(context.Web.ServerRelativeUrl + "/library3/" + currentFilingSystemItem["DealName"].ToString());
context.Load(folder);
context.ExecuteQuery(); 
folder.MoveTo(context.Web.ServerRelativeUrl + "/ArchDocs/" + currentFilingSystemItem["DealName"].ToString());
folder.Update();

context.Load(folder);
context.Load(folder.Files);
context.Load(folder.Folders);
FileCollection files = folder.Files;
FolderCollection folders = folder.Folders;
context.ExecuteQuery();
foreach (File f in files)
  {
     ListItem item = f.ListItemAllFields;
     context.Load(item);
     context.ExecuteQuery();
     item["DealStage"] = currentFilingSystemItem["DealStage"];
     item.Update();
     context.ExecuteQuery();

  }
foreach (Folder fo in folders)
  {

      ListItem item = fo.ListItemAllFields;
      context.Load(item);
      context.ExecuteQuery();
      item["DealStage"] = currentFilingSystemItem["DealStage"];
      item.Update();
      context.ExecuteQuery();

  }

where i am trying to change a managed metadta column named "DealStage" using this item["DealStage"] = currentFilingSystemItem["DealStage"]; for both File and Folders, but my above code will not raise any exception, but the DealStage will not get update! can anyone advice on this please? Thanks