class PersonalWeb
PersonalWeb is a SharePoint client class that provides methods for managing a user's personal web site, specifically operations on the user's default document library.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/personal_web.py
5 - 26
moderate
Purpose
This class represents the Microsoft.SharePoint.Client.Sharing.PersonalWeb namespace and provides functionality to manage SharePoint personal web sites for individual users. Its primary use case is fixing permission inheritance issues on the default document library when breakRoleInheritance fails during library creation. It inherits from Entity and integrates with the SharePoint client context to execute service operations.
Source Code
class PersonalWeb(Entity):
"""Microsoft.SharePoint.Client.Sharing.PersonalWeb namespace represents methods that apply to a Web site for
individual users. Methods act on the users default document library."""
@staticmethod
def fix_permission_inheritance(context):
"""
This method fixes the permission inheritance for the default document library of the personal web when
breakRoleInheritance didn't happen correctly during the default document library creation.
:param office365.sharepoint.client_context.ClientContext context: SharePoint client context
"""
binding_type = PersonalWeb(context)
qry = ServiceOperationQuery(
binding_type, "FixPermissionInheritance", None, None, None, None, True
)
context.add_query(qry)
return binding_type
@property
def entity_type_name(self):
return "SP.Sharing.PersonalWeb"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: An instance of office365.sharepoint.client_context.ClientContext that provides the connection and authentication context for SharePoint operations. This is required for all service operations and must be properly initialized with SharePoint site URL and credentials before use.
Return Value
The class constructor returns a PersonalWeb instance. The fix_permission_inheritance static method returns a PersonalWeb binding type object after queuing the permission fix operation in the provided context. The entity_type_name property returns the string 'SP.Sharing.PersonalWeb' which identifies the SharePoint entity type.
Class Interface
Methods
fix_permission_inheritance(context: ClientContext) -> PersonalWeb
static
Purpose: Fixes the permission inheritance for the default document library of the personal web when breakRoleInheritance didn't happen correctly during library creation
Parameters:
context: office365.sharepoint.client_context.ClientContext instance that provides the SharePoint connection and authentication context
Returns: PersonalWeb binding type object with the fix permission operation queued in the context
entity_type_name() -> str
property
Purpose: Returns the SharePoint entity type name identifier for this class
Returns: String 'SP.Sharing.PersonalWeb' representing the SharePoint entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
entity_type_name |
str | Property that returns the SharePoint entity type identifier 'SP.Sharing.PersonalWeb' | instance |
Dependencies
office365.runtime.queries.service_operationoffice365.sharepoint.entityoffice365.sharepoint.client_context
Required Imports
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.entity import Entity
from office365.sharepoint.client_context import ClientContext
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.sharing.personal_web import PersonalWeb
from office365.runtime.auth.client_credential import ClientCredential
# Initialize SharePoint context
site_url = 'https://yourtenant.sharepoint.com/sites/yoursite'
credentials = ClientCredential('client_id', 'client_secret')
ctx = ClientContext(site_url).with_credentials(credentials)
# Fix permission inheritance on personal web
personal_web = PersonalWeb.fix_permission_inheritance(ctx)
ctx.execute_query()
# Access entity type name
entity_type = personal_web.entity_type_name
print(f'Entity type: {entity_type}')
Best Practices
- Always ensure the ClientContext is properly authenticated before calling fix_permission_inheritance
- Call ctx.execute_query() after fix_permission_inheritance to actually execute the queued operation
- Use fix_permission_inheritance only when permission inheritance is broken during default document library creation
- The class inherits from Entity, so it follows the Entity lifecycle and state management patterns
- This is primarily a utility class with static methods - instantiation is handled internally by the static method
- The fix_permission_inheritance method queues an operation but doesn't execute it immediately - execution happens when execute_query is called on the context
- Ensure proper error handling around execute_query as SharePoint operations can fail due to permissions or network issues
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class WebPart 66.0% similar
-
class DocumentsSharedWithGroup 65.3% similar
-
class MySiteLinks 64.9% similar
-
class WebCollection 64.8% similar
-
class WebPartDefinition 64.6% similar