Unable to fetch Group description through CSOM for SharePoint Online

Abhinav Vashishtha 0 Reputation points
2023-04-26T09:06:40.5033333+00:00

While fetching SharePoint site Groups from SharePoint online using CSOM, I am getting all requested properties for the group except the Description even when the description is nonempty for the SharePoint group.

ClientContext context = new ClientContext("https://{site_url}"); Web web = context.Web; context.Load(web); context.ExecuteQuery(); context.Load(web.SiteGroups, x => x.Include(group => group.Id, group => group.Title, group => group.Users, group => group.Description)); context.ExecuteQuery();

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,298 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,810 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,597 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 33,641 Reputation points Microsoft Vendor
    2023-04-27T01:59:58.1033333+00:00

    Hi @Abhinav Vashishtha

    Per my test, I can retrieve group description by following code, please make a reference

    using (ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"))
    {
    // Get all the groups at site level
    GroupCollection oGroupCollection = clientcontext.Web.SiteGroups;
     
    clientcontext.Load(oGroupCollection);
    clientcontext.ExecuteQuery();
     
    // Iterate through each group
    foreach (Group oGroup in oGroupCollection)
    {
    Console.WriteLine("-------------title-------------");
    Console.WriteLine(oGroup.Title);
    Console.WriteLine("-------------Description-------------");
    Console.WriteLine(oGroup.Description);
    }
    }
    
    

    Here is the test result

    User's image

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.