javascript – How to get the email address of the users of the person or group field – using CSOM

To obtain the user's email address or username, you must use web.ensureUser() method and then get the email or login name as follows:


Reference: Retrieve the size and email of the person or group list field in SharePoint

Solution for you:

Then, for your case, you can use its function in this way:

function FunctionToReturnEmailAddress(employeeName) {
    var user = clientContext.get_web().ensureUser(employeeName);

            // successfully ensured user from user name
            var email = user.get_email();
            var login = user.get_loginName();
            var displayName = user.get_title();
            alert("User LoginName: " + login + "nUser Email: " + email + "nUser Display Name: " + displayName);
        },function(sender,args){ // on error



csom – Sharepoint Online Visual Webpart

I need to migrate the visual web part of SharePoint-2016 (C #) to SharePoint online. But the visual web part contains custom features such as common XML configuration tags, sending mail to users, authenticating AD groups, etc. What is the best way to migrate?

After performing some search, when using the provided hosted application, custom codes (c #) can be used in SharePoint Online. Kindly suggest any link or example.

Sharepoint online: how to create a new item as a link to the document in a csom powershell document library folder

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

client object model: retrieve shared links through CSOM

I currently have a program that will upload the selected files to a specific folder in SharePoint and give access to specific users based on their emails using the SharePoint CSOM API, however, I cannot generate links for people outside my domain.

For example:
I get


instead of


I am currently retrieving the first link using the code here:

I also tried other suggestions I found in StackExchange, such as: Manage links for shared files

All the examples I've found, like all of the above, result in incorrect links.

In case it is not clear at the moment, I am not looking for an anonymous link or how to create shared links (as I already have it working), I am after the link that will appear here:

enter the description of the image here

csom: access denied to the list after granting permissions to a group in a list

After granting View / Add / Edit / Open / Remove ListItems to the group in a list, the users of the group still get access denied when they try to access the list.
Here is the code I used to grant permissions:

var group = clientContext.Web.SiteGroups.GetById(id);   

 BasePermissions permissions = new BasePermissions();

 RoleDefinitionCreationInformation rdcInfo = new 
 rdcInfo.Name = "roleDefName";
 rdcInfo.Description = "Description";
 rdcInfo.BasePermissions = permissions;
 RoleDefinition roleDefinition = 

 RoleDefinitionBindingCollection RoleDefinitionBindingColl = new 

 List targetList = web.Lists.GetByTitle(listTitle);
 targetList.BreakRoleInheritance(true, false);
 RoleAssignmentCollection collRoleAssign = targetList.RoleAssignments;
 RoleAssignment rollAssign = collRoleAssign.Add(group, 

 web.RoleAssignments.Add(group, RoleDefinitionBindingColl);

Export items from the sharepoint list to Excel by csom c #

I am getting items from a list using caml query. After that, I need to export to Excel by csom (c #).

caml query: SharePoint CSOM list grouped and filtered

Given that it has a column called & # 39; Yellow & # 39; and a written number, and you want all elements to have more than 3 in your column & # 39; Yellow & # 39 ;.

ClientContext ctx = new ClientContext("");
List list = ctx.Web.Lists.GetByTitle("Log");
CamlQuery query = new CamlQuery();
    = ""
    + ""
    + "3";
ListItemCollection items = list.GetItems(query);

Sharepoint online: run CSOM code from .net core

Is there an option to run CSOM code from the .net core application?
I have a bot solution for this, I need to store all the details of the conversation in the SharePoint list.
When executing the code, I receive 400 incorrect request errors. How to solve this?
This is SharePoint online.
My code will be published in the Azure environment.

How do I identify only the workflow instances running a list item in Sharepoint Online CSOM

I can get all the workflows associated with an item in the list. But it seems that only one of the workflows can be executed for the list item in this list. I want to be able to find out what the workflow is running. This is the code snippet with which I am showing all the properties of a WorkflowInstance.

int listItemId = 6326;
var workflowInstances = wfInstanceService.EnumerateInstancesForListItem(listGUID, listItemId);
foreach (var instance in workflowInstances)
    PrintText("Instance ID: " + instance.Id.ToString(), sw);
    PrintText("Status: " + instance.Status.ToString(), sw);
    PrintText("Creation time: " + instance.InstanceCreated.ToString(), sw);
    PrintText("Last updated time: " + instance.LastUpdated.ToString(), sw);
    PrintText("User status: " + instance.UserStatus, sw);

    IDictionary props = instance.Properties;
    foreach(KeyValuePair kvp in props)
        PrintText(kvp.Key+": "+kvp.Value, sw);

    PrintText("---------", sw);

Let's say there are 5 workflows associated with the 6326 list item, I see that all the details are printed correctly. But I can't figure out which one is running with all the data I print above. (The PrintText function is essentially a Console.WriteLine). In the items on my list, I cannot assume that the most recently created workflow is also the one that is running.

Link to where I found these integrated functions: model

How do I determine which one is running?