SharePoint o365 Agent site selection automation

  • 25 November 2022
  • 3 replies

Badge +1

Hi All,

I have a bit of a challenge on my hands. I’m migrating a customer to the new SharePoint agent, but I cannot seem to find a way to effectively select the needed content. 

The situation is as follows the customer has 51K sites, but most of them are created by students, and should not be part of the backup. So we only want 1300 in the backup. In the previous agent I could do some magic with regex to make this happen. But I do not see a good solution in the new agent.

Both the Mail and OneDrive agent give me the opportunity to work with groups, but the SharePoint agent only has all sites, all group sites and project sites. Or i have to click 1300 sites which is not feasible, 

I also looked of a json to do this, but ne new agent does not take the json format of the old agent so that does not seem to be a solution as well. 


Anyone have any idea how I can do this, and possibly automate it so we can update the site content occasionally?


Best answer by Marcel Krommenhoek 30 November 2022, 13:51

View original

3 replies

Userlevel 6
Badge +14

Hello Marcel,


Can you please advise the Feature Release and Maintenance release you are currently running?

In support i have faced this question a few times and i know Dev have raised the topic of providing manual entry mode or a different method of filtering but it will depend on your version. 


Always happy to help!

Badge +1

My apologies for the late answer @Albert Williams we are running 11.28.24.

I am also looking at cvpysdk which seems to contain the correct funtions.

Im trying to use cvpysdk.sharepointsubclient.SharepointSubclient.update_sites_association_properties. But the documention does not specify what the content of site_user_accounts_lis should be:

site_user_accounts_list (list)   --  list of user accounts of all sites

                                                           It has all information of sites/webs


But if DEV can share some thoughts that would be great



Badge +1

Finally I have disocvered the datamodel behind site_user_accounts_list. It was a bit messy but ok. The issue was that when adding sites there is no link to "Equivalent API” in CommandCenter. So i was unable to see how the data was build up. But after playing arround a bit I found that if i select a site from the list and add it and then choose exlude from content i actually het the "Equivalent API”. There is some other irrelevant data, But i knew from the cvpysdk that i would only need UserAccounts part. So the correct json format for this list would be (cleaned for privacy):

        "displayName": "",
        "aliasName": "",
        "smtpAddress": "",
        "isAutoDiscoveredUser": false,
        "commonFlags": 8,
        "accountSize": 0,
        "user": {
            "userGUID": ""
        "itemType": "SITE",
        "ParentWebGuid": "",
        "BackupSetId": 0,
        "ItemClassification": "TEAM",
        "lastBackupJobRanTime": {
            "time": 0
        "EVGui_SharePointItem": [
                "fullPath": "",
                "relativePath": "/",
                "siteCollectionPath": "",
                "webPath": "",
                "objectType": 4,
                "contentPath": "",
                "Reserved_1": "GROUP",
                "Reserved_2": "",
                "stagedLocation": "",
                "siteId": "",
                "objectId": "",
                "databaseInstance": "1"
        "numberOfItems": 0,
        "IdxCollectionTime": {
            "time": 0
        "lastCleanupTime": {
            "time": 0
        "lastTrueUpTime": {
            "time": 0
        "lastAttemptTime": {
            "time": 0
        "lastAttemptStatus": 0,
        "licensingStatus": 0,
        "lastAttemptfailedCount": 0,
        "lastAttemptJobId": 0

If i feed this to the cvpysdk.sharepointsubclient.SharepointSubclient.update_sites_association_properties function after converting it to a list object, it works like a charm.