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

Dineshkumar T 5 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

Microsoft 365 and Office | SharePoint | For business | Windows
Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.