'System.MissingMethodException: Method not found: 'System.String Microsoft.SharePoint.Client.Site.get_Classification()' in csom package

Dineshkumar T 0 Reputation points
2023-11-06T12:33:55.8533333+00:00

I'm facing method not found exception while accessing the some properties in Microsoft.SharePoint.Client.Site

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
8,564 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,469 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 26,791 Reputation points Microsoft Vendor
    2023-11-08T01:10:06.6633333+00:00

    Hi @Dineshkumar T,

    Per my test, there is no Microsoft.SharePoint.Client.Site.get_Classification() function in CSOM. If you want to get site classification, you could refer to following code

    // Connect to the admin central of your tenant
    using (var adminContext = new ClientContext("https://[tenant]-admin.sharepoint.com/"))
    {
        // Provide a valid set of credentials
        adminContext.Credentials = OfficeDevPnP.Core.Utilities.CredentialManager.GetSharePointOnlineCredential("[name-of-your-credentials]");
        // Create a new instance of the Tenant class of CSOM
        var tenant = new Tenant(adminContext);
        // Get an Azure AD Access Token using ADAL, MSAL, or whatever else you like
        var accessToken = getAzureADAccessToken();
        // Retrieve the current set of values for site classification
        var classificationList = tenant.GetSiteClassificationList(accessToken); 
    }
    

    Here is the document for details

    https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-site-classification

    https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-csom/mt796389(v=office.15)


    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.