Ejemplo n.º 1
0
    def create_site_sync(self, url, owner, title=None):
        """Creates a site collection

         :param str title: Sets the new site’s title.
        :param str url: Sets the new site’s URL.
        :param str owner: Sets the login name of the owner of the new site.
        """
        return_type = Site(self.context)
        op = self.create_site(url, owner, title)

        def _verify_site_status(resp, items=None):
            """
            :type resp: requests.Response
            """
            if items is None:
                is_complete = op.is_complete
            else:
                is_complete = len([
                    item
                    for item in items if item.properties.get("SiteUrl") == url
                ]) > 0
            if not is_complete:
                time.sleep(op.polling_interval_secs)
                items = self.get_sites_by_state([0, 1, 2])
                self.context.after_execute(_verify_site_status, items=items)

            return_type.set_property("NewSiteUrl", url)

        self.context.after_execute(_verify_site_status)
        return return_type
Ejemplo n.º 2
0
 def personal_site(self):
     """
     The PersonalSite property specifies the user's personal site
     """
     return self.properties.get(
         "PersonalSite",
         Site(self.context, ResourcePath("PersonalSite",
                                         self.resource_path)))
Ejemplo n.º 3
0
    def get_personal_site(self):
        """Get personal site"""
        from office365.sharepoint.sites.site import Site
        site = Site(self.context)

        def _user_loaded():
            from office365.sharepoint.userprofiles.people_manager import PeopleManager
            people_manager = PeopleManager(self.context)
            person_props = people_manager.get_properties_for(self.login_name)

            def _person_props_loaded(resp):
                site.set_property("NewSiteUrl", person_props.personal_url)
            self.context.after_execute(_person_props_loaded)

        self.ensure_property("LoginName", _user_loaded)
        return site
Ejemplo n.º 4
0
 def site(self):
     """Get Site client object"""
     if not self._site:
         self._site = Site(self)
     return self._site