Cli-microsoft365: Enhancement: Extend `spo site set` command with support for setting the sharing capability of the site

Created on 16 Jul 2020  路  6Comments  路  Source: pnp/cli-microsoft365

Raised from #1648

We should extend the spo site set command with a new option called --sharingCapability that is optional, which accepts a valid SharingCapabilities value.

The valid values are as follows.

  • Disabled
  • ExternalUserSharingOnly
  • ExternalUserAndGuestSharing
  • ExistingExternalUserSharingOnly

Source: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/dn174825(v=office.15)

feature request new feature work in progress

Most helpful comment

Thanks @garrytrinder for the direction. I did.
I had snooped the fiddler trace for CSOM and have confirmed the payload which is being sent. I also had verified the fiddler trace for PnP PowerShell as well.
I would be finalizing the approach and would be making a PR pretty soon.
Thanks again for the support.

All 6 comments

Can I take ownership of this issue?

All yours @arjunumenon 馃憦

Hi @garrytrinder / @waldekmastykarz - I have made the implementation of the new feature which is to add SharingCapabilities to o365 spo site set

Before I finalize the approach, I just want to confirm the implementation.
Since SharingCapabilities setting could be enabled only thorough a REST call to the tenant URL. Following are the details

URL : https://TENANTNAME-admin.sharepoint.com/_vti_bin/client.svc/ProcessQuery

Request Body :

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="Office 365 CLI v2.13.0" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
    <Actions>
        <ObjectPath Id="2" ObjectPathId="1"/>
        <ObjectPath Id="4" ObjectPathId="3"/>
        <SetProperty Id="5" ObjectPathId="3" Name="SharingCapability">
            <Parameter Type="Enum">2</Parameter>
        </SetProperty>
        <ObjectPath Id="7" ObjectPathId="6"/>
        <ObjectIdentityQuery Id="8" ObjectPathId="3"/>
    </Actions>
    <ObjectPaths>
        <Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}"/>
        <Method Id="3" ParentId="1" Name="GetSitePropertiesByUrl">
            <Parameters>
                <Parameter Type="String">https://TENANTNAME.sharepoint.com/sites/SITENAME</Parameter>
                <Parameter Type="Boolean">false</Parameter>
            </Parameters>
        </Method>
        <Method Id="6" ParentId="3" Name="Update"/>
    </ObjectPaths>
</Request>

Can you verify and let me know the implementation is correct so that I could freeze the approach from my side. Let me know if you have any questions / my approach is not correct.

Hey @arjunumenon I'm not completely up on this API but it looks ok to me. I assume you've taken the approach of using Fiddler to snoop on the CSOM request to understand the required XML payload?

Thanks @garrytrinder for the direction. I did.
I had snooped the fiddler trace for CSOM and have confirmed the payload which is being sent. I also had verified the fiddler trace for PnP PowerShell as well.
I would be finalizing the approach and would be making a PR pretty soon.
Thanks again for the support.

Great, thanks for your help @arjunumenon 馃憤馃徎

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garrytrinder picture garrytrinder  路  3Comments

OodapowUiPath picture OodapowUiPath  路  3Comments

vineet2907 picture vineet2907  路  3Comments

plamber picture plamber  路  3Comments

thomyg picture thomyg  路  3Comments