def _picker_value_resolved(picker_value): from office365.sharepoint.webs.web import Web Web.share_object(self.context, file_result.value, picker_value, role_values[share_option], 0, False, send_email, False, email_subject, email_body, return_type=sharing_result)
def _picker_value_resolved(picker_value): from office365.sharepoint.webs.web import Web result.value = Web.share_object(self.context, file_result.value, picker_value, role_values[shareOption], 0, False, sendEmail, False, emailSubject, emailBody)
def rootWeb(self): """Get root web""" if self.is_property_available('RootWeb'): return self.properties['RootWeb'] else: return Web(self.context, ResourcePath("RootWeb", self.resource_path))
def add(self, web_creation_information): target_web = Web(self.context) self.add_child(target_web) qry = ServiceOperationQuery(self, "add", None, web_creation_information, "parameters", target_web) self.context.add_query(qry) return target_web
def open_web_by_id(self, web_id): """Returns the specified Web site from the site collection. :param str web_id: An identifier of the Web site """ return_type = Web(self.context) qry = ServiceOperationQuery(self, "OpenWebById", {"gWebId": web_id}, None, None, return_type) self.context.add_query(qry) return return_type
def add(self, web_creation_information): """ Create web site :type web_creation_information: office365.sharepoint.webs.web_creation_information.WebCreationInformation """ target_web = Web(self.context) self.add_child(target_web) qry = ServiceOperationQuery(self, "add", None, web_creation_information, "parameters", target_web) self.context.add_query(qry) return target_web
def open_web(self, str_url): """Returns the specified Web site from the site collection. :param str str_url: A string that contains either the server-relative or site-relative URL of the Web site or of an object within the Web site. A server-relative URL begins with a forward slash ("/"), while a site-relative URL does not begin with a forward slash. """ return_type = Web(self.context) qry = ServiceOperationQuery(self, "OpenWeb", {"strUrl": str_url}, None, None, return_type) self.context.add_query(qry) return return_type
def from_url(abs_url): """ Constructs ClientContext from absolute Url :param str abs_url: Absolute Url to resource :return: ClientContext """ base_url = resolve_base_url(abs_url) ctx = ClientContext(base_url) result = Web.get_web_url_from_page_url(ctx, abs_url) def _init_context_for_web(resp): ctx._base_url = result.value ctx.after_execute(_init_context_for_web) return ctx
def test5_create_file_anon_link(self): file_url = self.__class__.target_file.serverRelativeUrl result = Web.create_anonymous_link(self.client, file_url, False) self.client.execute_query() self.assertIsNotNone(result.value)
def web(self): """Gets the SPWeb.""" return self.properties.get('Web', Web(self.context, ResourcePath("Web", self.resource_path)))
2: "An organization access link with view permissions to an object", 3: "An organization access link with edit permissions to an object", 4: "An anonymous access link with view permissions to an object", 5: "An anonymous access link with edit permissions to an object", 6: "A tokenized sharing link where properties can change without affecting link URL" } file_url = "/sites/team/Shared Documents/SharePoint User Guide.docx" target_file = ctx.web.get_file_by_server_relative_url(file_url) # Share a file link result = target_file.share_link(SharingLinkKind.AnonymousView).execute_query() print(json.dumps(result.value.to_json(), indent=4)) link_url = result.value.sharingLinkInfo.Url # Verify a link result = Web.get_sharing_link_kind(ctx, link_url).execute_query() print(sharing_messages.get(result.value, "Unknown sharing link")) # Unshare a file link target_file.unshare_link(SharingLinkKind.AnonymousView).execute_query() # Get a file sharing info info = target_file.get_sharing_information().execute_query() print("AnonymousViewLink:", info.properties.get('AnonymousViewLink'))
def _property_resolved(): abs_url = self.get_property("EncodedAbsUrl") from office365.sharepoint.webs.web import Web result.value = Web.unshare_object(self.context, abs_url)
def parent_web(self): """Gets a value that specifies the web where list resides.""" from office365.sharepoint.webs.web import Web return self.properties.get( 'ParentWeb', Web(self.context, ResourcePath("parentWeb", self.resource_path)))
def test_16_get_document_and_media_libraries(self): collection = Web.get_document_and_media_libraries( self.client, settings["url"], True) self.client.execute_query() self.assertGreater(len(collection), 0)
def root_web(self): """Get root web""" return self.properties.get('RootWeb', Web(self.context, ResourcePath("RootWeb", self.resource_path)))
def test_15_get_catalog(self): collection = Web.get_document_libraries(self.client, settings["url"]) self.client.execute_query() self.assertGreater(len(collection), 0)
def test2_get_web_from_page_url(self): page_url = "{site_url}SitePages/Home.aspx".format( site_url=settings['url']) result = Web.get_web_url_from_page_url(self.client, page_url) self.client.execute_query() self.assertIsNotNone(result.value)
def test_16_get_document_and_media_libraries(self): result = Web.get_document_and_media_libraries(self.client, test_site_url, True).execute_query() self.assertGreater(len(result.value), 0)
def web(self): """Get Web client object""" if not self._web: self._web = Web(self) return self._web
def test_21_get_context_web_theme_data(self): result = Web.get_context_web_theme_data(self.client).execute_query() self.assertIsNotNone(result.value)
def test2_get_object_sharing_settings(self): result = Web.get_object_sharing_settings(self.client, self.target_file_url, 0, True) self.client.execute_query() self.assertIsNotNone(result.web_url)
def test_15_get_document_libraries(self): collection = Web.get_document_libraries(self.client, test_site_url) self.client.execute_query() self.assertGreater(len(collection), 0)