-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint new types and model update
- Loading branch information
Showing
52 changed files
with
641 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
from office365.runtime.client_request_exception import ClientRequestException | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.tenant.administration.tenant import Tenant | ||
from tests import test_admin_credentials, test_admin_site_url, test_user_principal_name | ||
|
||
admin_client = ClientContext(test_admin_site_url).with_credentials( | ||
test_admin_credentials | ||
) | ||
tenant = Tenant(admin_client) | ||
result = tenant.get_site_properties_from_sharepoint_by_filters("").execute_query() | ||
""" | ||
Gets my sites | ||
""" | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from tests import test_site_url, test_user_credentials | ||
|
||
def try_get_user_permissions(site_url, user_name): | ||
ctx = ClientContext(site_url).with_credentials(test_admin_credentials) | ||
try: | ||
ctx.web.get_user_effective_permissions(user_name).execute_query() | ||
# todo: determine user permissions from result | ||
return True | ||
except ClientRequestException as e: | ||
if e.response.status_code == 404: | ||
return False | ||
else: | ||
raise ValueError(e.response.text) | ||
|
||
client = ClientContext(test_site_url).with_credentials(test_user_credentials) | ||
|
||
for siteProps in result: | ||
print("Current site url: {0}".format(siteProps.url)) | ||
if try_get_user_permissions(siteProps.url, test_user_principal_name) is True: | ||
print( | ||
"Site url {0} {1} user has access to".format( | ||
siteProps.url, test_user_principal_name | ||
) | ||
) | ||
result = client.search.query("contentclass:STS_Site").execute_query() | ||
results = result.value.PrimaryQueryResult.RelevantResults | ||
for row in results.Table.Rows: | ||
site_url = row.Cells["Path"] | ||
print(site_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.entity import Entity | ||
|
||
|
||
class AccessRequests(Entity): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.entity import Entity | ||
|
||
|
||
class VersionPolicyManager(Entity): | ||
""" """ |
27 changes: 26 additions & 1 deletion
27
office365/sharepoint/portal/userprofiles/documents_shared_with_group.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
from office365.runtime.queries.service_operation import ServiceOperationQuery | ||
from office365.sharepoint.entity import Entity | ||
from office365.sharepoint.entity_collection import EntityCollection | ||
from office365.sharepoint.userprofiles.sharedwithme.document import SharedWithMeDocument | ||
|
||
|
||
class DocumentsSharedWithGroup(Entity): | ||
""" | ||
Provides methods for working with a list that shares documents with a SharePoint Group on the user's personal site. | ||
""" | ||
|
||
@staticmethod | ||
def get_shared_with_group_docs(context, group_id=None): | ||
""" | ||
Gets a shared documents for a group. | ||
:param office365.sharepoint.client_context.ClientContext context: SharePoint context | ||
:param str group_id: | ||
""" | ||
return_type = EntityCollection(context, SharedWithMeDocument) | ||
payload = {"groupId": group_id} | ||
qry = ServiceOperationQuery( | ||
DocumentsSharedWithGroup(context), | ||
"GetSharedWithGroupDocs", | ||
None, | ||
payload, | ||
None, | ||
return_type, | ||
True, | ||
) | ||
context.add_query(qry) | ||
return return_type | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.SharePoint.Portal.UserProfiles.DocumentsSharedWithGroup" | ||
return "Microsoft.SharePoint.Portal.UserProfiles.group_id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class SitePageCoAuthState(ClientValue): | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "SP.Publishing.SitePageCoAuthState" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class SitePageStreamContent(ClientValue): | ||
""" """ | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "SP.Publishing.SitePageStreamContent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class SitePageStreamData(ClientValue): | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "SP.Publishing.SitePageStreamData" |
8 changes: 8 additions & 0 deletions
8
office365/sharepoint/quotamanagement/consumer/non_quota_backfill_api.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.sharepoint.entity import Entity | ||
|
||
|
||
class NonQuotaBackfillApi(Entity): | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.SharePoint.QuotaManagement.Consumer.NonQuotaBackfillApi" |
11 changes: 11 additions & 0 deletions
11
office365/sharepoint/search/administration/site_content_processing_info_provider.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
from office365.runtime.client_result import ClientResult | ||
from office365.runtime.queries.service_operation import ServiceOperationQuery | ||
from office365.sharepoint.entity import Entity | ||
|
||
|
||
class SiteContentProcessingInfoProvider(Entity): | ||
|
||
def get_azure_container_token(self): | ||
return_type = ClientResult(self.context, str()) | ||
qry = ServiceOperationQuery( | ||
self, "GetAzureContainerToken", None, None, None, return_type | ||
) | ||
self.context.add_query(qry) | ||
return return_type | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.SharePoint.Client.Search.Administration.SiteContentProcessingInfoProvider" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class ReportAbandonedQueriesItem(ClientValue): | ||
pass |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from office365.runtime.client_value_collection import ClientValueCollection | ||
from office365.sharepoint.search.reports.base import ReportBase | ||
from office365.sharepoint.search.reports.topqueries.item import ReportTopQueriesItem | ||
|
||
|
||
class ReportTopQueries(ReportBase): | ||
|
||
def __init__(self, reports=None): | ||
super(ReportTopQueries, self).__init__() | ||
self.Reports = ClientValueCollection(ReportTopQueriesItem, reports) | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.Office.Server.Search.REST.ReportTopQueries" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class ReportTopQueriesData(ClientValue): | ||
""" """ | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.Office.Server.Search.REST.ReportTopQueriesData" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from office365.runtime.client_value import ClientValue | ||
from office365.runtime.client_value_collection import ClientValueCollection | ||
from office365.sharepoint.search.reports.topqueries.data import ReportTopQueriesData | ||
|
||
|
||
class ReportTopQueriesItem(ClientValue): | ||
""" """ | ||
|
||
def __init__(self, date=None, report=None): | ||
self.Date = date | ||
self.Report = ClientValueCollection(ReportTopQueriesData, report) | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.Office.Server.Search.REST.ReportTopQueriesItem" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class ScsEndpoint(ClientValue): | ||
""" """ | ||
|
||
@property | ||
def entity_type_name(self): | ||
return "Microsoft.Office.Server.Search.REST.ScsEndpoint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.