How to edit the properties of the web element in REST or CSOM?

This is a follow-up to my previous question, How to get all the properties of a site page using the REST API? When using REST in an AngularJS application, I was able to read the properties of the Title Bar of the web part page and see if the property of the image was populated. Now I realize that I have to EDIT the property too.

Can I use the REST API to edit a web element? Or do I need to use CSOM? I have used CSOM in the past to edit the User Information List (because that is a list that can not be edited with REST). But I'm not sure how to proceed.

SharePoint Online: Get the number of children in the document library using CSOM

I'm not sure what you're doing in your CAML – You're probably looking for ltitems.cuenta.

You could also work with the folders in the library in this way:

using (var ctx = new ClientContext (...))
{
var web = ctx.Web;
var lib = web.Lists.GetByTitle ("Documents");
ctx.Load (lib);
ctx.ExecuteQuery ();
Console.WriteLine ("ItemCount in the library: {0}", lib.ItemCount);
var root = lib.RootFolder;
ctx.Load (root, f => f.ItemCount, f => f.Folders);
ctx.ExecuteQuery ();
Console.WriteLine ("elements in the root: {0}", root.ItemCount);
Console.WriteLine ("folders at the root: {0}", root.Folders.Count ());

var folder = root.Folders.Single (f => f.Name == "Test");
ctx.Load (folder, f => f.ItemCount, f => f.Folders);
ctx.ExecuteQuery ();
Console.WriteLine ("elements in {0}: {1}", folder.Name, folder.ItemCount);
Console.WriteLine ("folders in {0}: {1}", folder.Name, folder.Folders.Count ());
}

Keep in mind that the folder count in the root folder is always one more than what you "see" in the user interface. (The one called "Attachments".)

javascript – Elements of the CSOM copy list

I was creating a custom action from the ribbon and I was trying to copy the elements of the selected list into the same list, but did F12 error? What is the problem?

enter the description of the image here

function runCode () {
var targetListItem;
the values ​​of var = SP.ListOperation.Selection.getSelectedItems ();
var clientContext = new SP.ClientContext.get_current ();
var listId = SP.ListOperation.Selection.getSelectedList ();
var targetList = clientContext.get_web (). get_lists (). getById (listId);
targetListItem = targetList.getItemById (values[0].I.D);
clientContext.load (targetListItem);
clientContext.executeQueryAsync (function () {
var itemCreateInfo = new SP.ListItemCreationInformation ();
var oListItem = targetList.addItem (itemCreateInfo);
oListItem.set_item (& # 39; Title & # 39 ;, targetListItem.get_item (& # 39; Title & # 39;));
oListItem.update ();
clientContext.load (oListItem);
clientContext.executeQueryAsync (function () {
SP.UI.Notify.addNotification (& # 39; Item created! & # 39 ;, False);
SP.UI.ModalDialog.RefreshPage (SP.UI.DialogResult.OK);
}, Function.createDelegate (this, this.onQueryFailed));

}, Function.createDelegate (this, this.onQueryFailed));
}

onQueryFailed function (sender, args) {
alert (& # 39; The request failed. & # 39; + args.get_message () + & # 39;  n & # 39; + args.get_stackTrace ());
}

Error:

Sys.ArgumentUndefinedException: the value can not be null. Parameter
name: method

csom sharpoint online – SharePoint Stack Exchange

I have a requirement where I need to create an escalation matrix, I had four columns in a shared access point like below

Column1 | Column2 | PersonGroup1 | PersonGroup2

I had to send an email to the PersonGroup1 user all items tagged under it, post 7 days if column 1, which is the status column not closed, will be sent to PersonGroup2

I am creating the console application c # client object model using clientutility to send email

sharepoint online – How to overwrite the version of a file using CSOM?

When I register as a main version or a secondary version, I create the new version as main. Below is the code:

static void private file UploadFiles (string sourceFileUrl, Folder targetFolder, string fileName, ClientContext clientContext, ClientContext destinationContext, bool bolMajorVersion)
{

FileCreationInformation targetFileVersionCreationInfo = new FileCreationInformation ();
targetFileVersionCreationInfo.Overwrite = true;
try
{
Web request request = HttpWebRequest.Create (sourceFileUrl);
request.Credentials = clientContext.Credentials;
using (response from WebResponse = request.GetResponse ())
{
using (Stream Stream = response.GetResponseStream ())
{
byte[] verBuffer = new byte[32768];
using (MemoryStream versionMS = new MemoryStream ())
{
Int read
while ((read = stream.Read (seeBuffer, 0, seeBuffer.Length))> 0)
{
versionMS.Write (seeBuffer, 0, read);
}
versionMS.Seek (0, SeekOrigin.Begin);
targetFileVersionCreationInfo.ContentStream = versionMS;
destinationContext.RequestTimeout = System.Threading.Timeout.Infinite;
targetFileVersionCreationInfo.Url = targetFolder.ServerRelativeUrl + "/" + fileName;
Microsoft.SharePoint.Client.File targetVersionFile = targetFolder.Files.Add (targetFileVersionCreationInfo);

File Microsoft.SharePoint.Client.File = targetVersionFile;
// Checkout if you are registered
destinationContext.Load (file);

destinationContext.ExecuteQuery ();

if (file.CheckOutType == CheckOutType.None)
{
file.CheckOut ();
}
// ListItem lstItem = file.ListItemAllFields;
//clientContext.Load(lstItem);
//clientContext.ExecuteQuery ();
yes (bolMajorVersion)
{

file.CheckIn ("Uploaded through the portal", CheckinType.MajorCheckIn);

}
plus
{
// Overwrite to avoid creating a new version.
file.CheckIn ("Uploaded through the portal", CheckinType.MinorCheckIn);
}
destinationContext.ExecuteQuery ();
// destinationContext.ExecuteQuery ();





}
}
}
}
catch (ex exception)
{
// handle the exception
}
}

The file is initially loaded with version 0.1 after registering as a major version, creating a new version 1.0 and also maintaining version 0.1. I need to overwrite this file from version 0.1.

Any help should be appreciated.

online sharepoint – CSOM: can not update or create the content type: the value can not be null. Name of the parameter: s

When creating or updating content types using PnP / CSOM, we encounter the following error when executing the query:

Microsoft.SharePoint.Client.ServerException: the value can not be null.
Name of the parameter: s

The routine had been working for months until the last couple of days, and it only seems to affect some tenants, it works well for most of the others.

The type of content in question is a relatively simple type of content.

Has anyone else encountered this error? Or do you have a solution?

C # CSOM Create folder and update the SharePoint list (in the 2019 installations)

I have a task where I need to perform the following tasks;

  1. Create a folder in SharePoint Titled in the name of a company
  2. Update a URL field of the item in the list with the URL of the folder in step 1, where the name of the company matches

I'm trying to do this in a script. I managed to do step one, but I'm really struggling with the transition to step 2. How can I get the URL of the folder I just created and update the list item in another list?

This is what I have (thanks in advance);

static main vacuum (chain[] args)
{
// Metadata for new folder
string collection = "BVI";
string siteUrl = string.Concat ("http: //opm.group.local/sites", "/", collection);
string library = "Library";
string title = "Title";
string refCode = "RefCode";
chain manager = "Administrator";
string manager = "Manager";
string clientDirector = "ClientDirector";
string administratorGroup = "AdminGroup";

// CREATE FOLDER AND UPDATE METADATA
using (ClientContext ctx = new ClientContext (siteUrl))
{
// Get Library by Name
List byTitle = ctx.Web.Lists.GetByTitle (library);

// New object of the ListItemCreationInformation class
ListItemCreationInformation listItemCreationInformation = new ListItemCreationInformation ();

// Create folder in lib
listItemCreationInformation.UnderlyingObjectType = FileSystemObjectType.Folder;

// Set the name of the internal folder
listItemCreationInformation.LeafName = title;
ListItem listitem = byTitle.AddItem (listItemCreationInformation);

// Set folder name
listitem["Title"] = ref code;

// Set folder metadata
listitem["EntityNumber"] = ref code;
listitem["RefCode"] = ref code;
listitem["Administrator"] = administrator;
listitem["Manager"] = manager;
listitem["ClientDirector"] = clientDirector;
listitem["AdministratorGroup"] = administratorGroup;

listitem.Update ();
ctx.ExecuteQuery ();
}

}

Online sharepoint: CSOM access to virus detection status

I am connecting to a SharePoint Online lease and interrogating a document library using CSOM. Is it possible to determine in code if the antimalware scan (which I know runs asynchronously) has finished scanning the library file that interests me? I know that using the old sharepoint API, I could interrogate an SPFile and see the SPVirusCheckStatus, but I can not see anything similar in CSOM.

Get all external users of a SharePoint site using CSOM Powershell

I want all external users of a SharePoint 2013 site to use CSOM or C # CSOM powershell since we do not have tenant administrator rights to use the Connect-SPOservice command. Is there a script in PnP or CSOM to get all the external users? Please come.

Can not update the user profile property using CSOM for SharePoint onprem

I am trying to update the ownership of the user profile using CSOM for SharePoint on premise, but the value was not updated in the property. There is no error exception.
I try with JSOM but it does not work too.
Has anyone solved this problem like me?

string accountName = "domain \ userloginname";
ClientContext clientContext = new ClientContext (url);
NetworkCredential ncr = new NetworkCredential (accountName, securePassword);
clientContext.Credentials = ncr;

var peopleManager = new PeopleManager (clientContext);
peopleManager.SetSingleValueProfileProperty (accountName, "AboutMe", "Value by CSOM");
clientContext.ExecuteQuery ();