コード例 #1
0
    def test_14_get_entity_type_name(self):
        type_name = ODataType.resolve_type([""])
        self.assertEqual(type_name, "Collection(Edm.String)")

        guid_coll = GuidCollection()
        self.assertEqual(guid_coll.entity_type_name, "Collection(Edm.Guid)")

        custom_type_name = ODataType.resolve_type(
            SecondaryAdministratorsFieldsData())
        self.assertEqual(
            custom_type_name,
            "Microsoft.Online.SharePoint.TenantAdministration.SecondaryAdministratorsFieldsData"
        )

        str_type_name = ODataType.resolve_type(StringCollection())
        self.assertEqual(str_type_name, "Collection(Edm.String)")

        str_col = StringCollection()
        self.assertEqual(str_col.entity_type_name, "Collection(Edm.String)")

        type_item = SecondaryAdministratorsFieldsData()
        self.assertEqual(
            type_item.entity_type_name,
            "Microsoft.Online.SharePoint.TenantAdministration.SecondaryAdministratorsFieldsData"
        )

        type_col = ClientValueCollection(SecondaryAdministratorsFieldsData)
        expected_type = "Collection(Microsoft.Online.SharePoint.TenantAdministration.SecondaryAdministratorsFieldsData)"
        self.assertEqual(type_col.entity_type_name, expected_type)
 def __init__(self, site_id=None, emails=None, names=None):
     """
     :type emails: List[str] or None
     :type names: List[str] or None
     :type site_id: str or None
     """
     super(SecondaryAdministratorsFieldsData, self).__init__()
     self.secondaryAdministratorEmails = StringCollection(emails)
     self.secondaryAdministratorLoginNames = StringCollection(names)
     self.siteId = site_id
コード例 #3
0
 def __init__(self, json=None, warnings=None):
     """
     :param str json:
     :param list[str] warnings:
     """
     self.JSON = json
     self.Warnings = StringCollection(warnings)
コード例 #4
0
    def roles(self, value):
        """
        Sets the type of permission

        :type value: list[str]
        """
        self.set_property("roles", StringCollection(value))
コード例 #5
0
 def identifier_uris(self):
     """
     The URIs that identify the application within its Azure AD tenant, or within a verified custom domain
     if the application is multi-tenant. For more information see Application Objects and Service Principal Objects.
     The any operator is required for filter expressions on multi-valued properties.
     """
     return self.properties.get('identifierUris', StringCollection())
コード例 #6
0
 def __init__(self,
              query,
              entity_types=None,
              fields=None,
              search_from=None,
              sort_properties=None,
              content_sources=None):
     """
     :param office365.search.query.SearchQuery query: Contains the query terms.
     :param list[str] entity_types: One or more types of resources expected in the response.
         Possible values are: list, site, listItem, message, event, drive, driveItem, externalItem.
         See known limitations for those combinations of two or more entity types that are supported in the
         same search request.
     :param list[str] fields: Contains the fields to be returned for each resource object specified in entityTypes,
         allowing customization of the fields returned by default; otherwise, including additional fields such
         as custom managed properties from SharePoint and OneDrive, or custom fields in externalItem from the
         content that Microsoft Graph connectors bring in. The fields property can use the semantic labels
         applied to properties. For example, if a property is labeled as title, you can retrieve it using
         the following syntax: label_title.
     :param int search_from: Specifies the offset for the search results. Offset 0 returns the very first result.
     :param list[SortProperty] sort_properties: Contains the ordered collection of fields and direction to
         sort results. There can be at most 5 sort properties in the collection.
     :param list[str] content_sources: Contains the connection to be targeted.
     """
     super(SearchRequest, self).__init__()
     self.query = query
     self.entityTypes = entity_types
     self.fields = fields
     self.search_from = search_from
     self.sortProperties = ClientValueCollection(SortProperty,
                                                 sort_properties)
     self.contentSources = StringCollection(content_sources)
コード例 #7
0
    def __init__(self, principal_name, password, display_name=None, given_name=None, company_name=None,
                 business_phones=None, office_location=None, city=None, country=None, account_enabled=False):
        """
        User profile

        :type principal_name: str
        :type password: str
        :type display_name: str
        :type account_enabled: bool
        :type given_name: str
        :type company_name: str
        :type business_phones: list[str]
        :type office_location: str
        :type city: str
        :type country: str
        """
        super(UserProfile, self).__init__()
        self.userPrincipalName = principal_name
        self.passwordProfile = PasswordProfile(password)
        self.mailNickname = principal_name.split("@")[0]
        self.displayName = display_name or principal_name.split("@")[0]
        self.accountEnabled = account_enabled
        self.givenName = given_name
        self.companyName = company_name
        self.businessPhones = StringCollection(business_phones)
        self.officeLocation = office_location
        self.city = city
        self.country = country
コード例 #8
0
    def search_principals_using_context_web(context,
                                            s_input,
                                            sources,
                                            scopes,
                                            max_count,
                                            group_name=None):
        """
        Returns the collection of principals that partially or uniquely matches the specified search criteria in the
        context of the current Web site

        :param str s_input: Specifies the value to be used when searching for a principal.
        :param str sources: Specifies the source to be used when searching for a principal.
        :param int scopes: Specifies the type to be used when searching for a principal.
        :param int max_count: Specifies the maximum number of principals to be returned.
        :param str or None group_name:  Specifies the name of a site collection group in the site collection that
            contains the current Web site. The collection of users in this site collection group is used when searching
            for a principal.
        :type context: office365.sharepoint.client_context.ClientContext
        """
        result = ClientResult(context, StringCollection())
        utility = Utility(context)
        params = {
            "input": s_input,
            "sources": sources,
            "scopes": scopes,
            "maxCount": max_count,
            "groupName": group_name
        }
        qry = ServiceOperationQuery(utility, "SearchPrincipalsUsingContextWeb",
                                    params, None, None, result)
        qry.static = True
        context.add_query(qry)
        return result
コード例 #9
0
 def categories(self):
     """
     The list of categories for the application. Supported values can be: Collaboration, Business Management,
     Consumer, Content management, CRM, Data services, Developer services, E-commerce, Education, ERP, Finance,
     Health, Human resources, IT infrastructure, Mail, Management, Marketing, Media, Productivity,
     Project management, Telecommunications, Tools, Travel, and Web design & hosting.
     """
     return self.properties.get("categories", StringCollection())
コード例 #10
0
    def extended_reports(self):
        """
        The ExtendedReports properties specifies an array of strings that specify the account names of
        person's extended reports.

        :rtype: StringCollection
        """
        return self.properties.get('ExtendedReports', StringCollection())
コード例 #11
0
    def extended_managers(self):
        """
        The ExtendedManagers property specifies an array of strings that specify the account names of
        a person's managers.

        :rtype: StringCollection
        """
        return self.properties.get('ExtendedManagers', StringCollection())
コード例 #12
0
 def __init__(self, people_names=None):
     """
     :param list[str] people_names: People names suggested for the user query. MUST be null if
         ShowPeopleNameSuggestions in properties input element is set to false.
     """
     self.PeopleNames = StringCollection(people_names)
     self.PersonalResults = ClientValueCollection(PersonalResultSuggestion)
     self.PopularResults = ClientValueCollection(PersonalResultSuggestion)
     self.Queries = ClientValueCollection(QuerySuggestionQuery)
コード例 #13
0
 def __init__(self, allow_text_entry=True, choices=None, display_as=None):
     """
     :param bool allow_text_entry: If true, allows custom values that aren't in the configured choices.
     :param list[str] choices: The list of values available for this column.
     :param str display_as: How the choices are to be presented in the UX. Must be one of checkBoxes,
         dropDownMenu, or radioButtons
     """
     self.allowTextEntry = allow_text_entry
     self.choices = StringCollection(choices)
     self.displayAs = display_as
コード例 #14
0
 def get_blocked_file_extensions(context):
     """
     :type context: office365.sharepoint.client_context.ClientContext
     """
     binding_type = ServerSettings(context)
     return_type = ClientResult(context, StringCollection())
     qry = ServiceOperationQuery(binding_type, "GetBlockedFileExtensions", None, None, None, return_type)
     qry.static = True
     context.add_query(qry)
     return return_type
コード例 #15
0
 def target_objects(self):
     """
     Following values are supported. Not nullable.
     User
     Group
     Organization
     Device
     Application
     """
     return self.properties.get("targetObjects", StringCollection())
コード例 #16
0
    def get_member_objects(self, security_enabled_only=True):
        """Returns all the groups and directory roles that a user, group, or directory object is a member of.
        This function is transitive.

        :type security_enabled_only: bool"""
        result = ClientResult(self.context, StringCollection())
        payload = {"securityEnabledOnly": security_enabled_only}
        qry = ServiceOperationQuery(self, "getMemberObjects", None, payload,
                                    None, result)
        self.context.add_query(qry)
        return result
コード例 #17
0
    def get_user_permission_levels(context):
        """
        Retrieves a collection of permission levels of the current user on the web.

        :type context: office365.sharepoint.client_context.ClientContext
        """
        result = ClientResult(context, StringCollection())
        utility = Utility(context)
        qry = ServiceOperationQuery(utility, "GetUserPermissionLevels", None,
                                    None, None, result)
        qry.static = True
        context.add_query(qry)
        return result
コード例 #18
0
    def assign_license(self, add_licenses, remove_licenses):
        """
        Add or remove licenses on the user.

        :param list[str] remove_licenses: A collection of skuIds that identify the licenses to remove.
        :param list[AssignedLicense] add_licenses: A collection of assignedLicense objects that specify
             the licenses to add.
        """
        params = {
            "addLicenses": ClientValueCollection(AssignedLicense,
                                                 add_licenses),
            "removeLicenses": StringCollection(remove_licenses)
        }
        qry = ServiceOperationQuery(self, "assignLicense", None, params, None,
                                    self)
        self.context.add_query(qry)
        return self
コード例 #19
0
 def __init__(self,
              include_branding=None,
              included_lists=None,
              include_links_to_exported_items=None,
              include_regional_settings=None,
              include_site_external_sharing_capability=None,
              include_theme=None):
     """
     :param bool include_branding:
     :param list[str] included_lists:
     :param bool include_site_external_sharing_capability:
     :param bool include_theme:
     """
     self.IncludeBranding = include_branding
     self.IncludedLists = StringCollection(included_lists)
     self.IncludeLinksToExportedItems = include_links_to_exported_items
     self.IncludeRegionalSettings = include_regional_settings
     self.IncludeSiteExternalSharingCapability = include_site_external_sharing_capability
     self.IncludeTheme = include_theme
コード例 #20
0
    def associate_with_hub_sites(self,
                                 hub_site_urls,
                                 propagate_to_existing_lists=False):
        """
        Associate a published content type present in a content type hub with a list of hub sites.
        Note: This feature is limited to tenants that have a SharePoint Syntex license.

        :param list[str] hub_site_urls: List of canonical URLs to the hub sites where the content type needs to
            be enforced. Required.
        :param bool propagate_to_existing_lists: If true, content types will be enforced on existing lists in the
            hub sites; otherwise, it'll be applied only to newly created lists.
        """
        payload = {
            "hubSiteUrls": StringCollection(hub_site_urls),
            "propagateToExistingLists": propagate_to_existing_lists
        }
        qry = ServiceOperationQuery(self, "associateWithHubSites", None,
                                    payload)
        self.context.add_query(qry)
        return self
コード例 #21
0
    def grant(self, recipients, roles):
        """
        Grant users access to a link represented by a permission.

        :param list[str] recipients: A collection of recipients who will receive access.
        :param list[str] roles: If the link is an "existing access" link, specifies roles to be granted to the users.
            Otherwise must match the role of the link.
        """
        payload = {
            "recipients":
            ClientValueCollection(
                DriveRecipient,
                [DriveRecipient.from_email(r) for r in recipients]),
            "roles":
            StringCollection(roles)
        }
        return_type = EntityCollection(
            self.context, Permission,
            ResourcePath("permissions", self.resource_path))
        qry = ServiceOperationQuery(self, "grant", None, payload, None,
                                    return_type)
        self.context.add_query(qry)
        return return_type
コード例 #22
0
 def __init__(self,
              query_text,
              select_properties=None,
              culture=None,
              trim_duplicates=False,
              row_limit=None,
              rows_per_page=None,
              start_row=None,
              enable_sorting=None,
              sort_list=None,
              query_template=None,
              ranking_model_id=None,
              summary_length=None,
              collapse_specification=None,
              client_type=None,
              enable_query_rules=None,
              source_id=None,
              **kwargs):
     """
     :param str query_text: The query text of the search query. If this element is not present or a value is not
         specified, a default value of an empty string MUST be used, and the server MUST return a
         FaultException<ExceptionDetail> message.
     :param list[str] or None select_properties: As specified in [MS-QSSWS] section 2.2.4.11.
     :param list[str] or None culture: Specifies the identifier of the language culture of the search query.
         If present, the value MUST be a valid language code identifier (LCID) of a culture name,
         as specified in [RFC3066].
     :param bool or None trim_duplicates:  Specifies whether duplicates are removed by the protocol server
         before sorting, selecting, and sending the search results. A value of "true" indicates that the protocol
         server SHOULD perform duplicate result removal. A value of "false" indicates that the protocol server
         MUST NOT attempt to perform duplicate result removal. If this element is not present or a value is
         not specified, a default value of "true" MUST be used. The algorithm used for duplicate detection is
         specific to the implementation of the protocol server.
     :param str or None ranking_model_id: The GUID of the ranking model that SHOULD be used for this search query.
         If this element is not present or a value is not specified, the protocol server MUST use the default
         ranking model, according to protocol server configuration.
     :param int or None row_limit: The number of search results the protocol client wants to receive, starting at
         the index specified in the StartRow element. The RowLimit value MUST be greater than or equal to zero.
     :param bool or None enable_sorting: Specifies whether sorting of results is enabled or not.
         MUST ignore the SortList specified if this value is set to false.
     :param list[Sort] or None sort_list: Specifies the list of properties with which to sort the search results.
         MUST be a SortCollection data type, as specified in section 3.1.4.7.3.4. If this element is not present
         or a value is not specified, the default managed property Rank and default direction
         of "Descending" MUST be used.
     :param str or None query_template: This is the text that will replace the query text.
         It can contain query variables which a query transform will replace during execution of the query.
     :param int or None summary_length:  The maximum number of characters in the result summary.
         The protocol server MUST return a HitHighlightedSummary property that contains less than or equal
         to SummaryLength number of characters. The SummaryLength value MUST be greater than or equal to zero
         and less than or equal to 10000.
     :param int or None start_row:  zero-based index of the first search result in the list of all search results
         the protocol server returns. The StartRow value MUST be greater than or equal to zero.
     :param int or None rows_per_page: The number of result items the protocol client displays per page.
         If this element is set to an integer value less than 1, the value of the RowLimit element MUST be used
         as the default value.
     :param str or None collapse_specification: A set of collapse specifications containing managed properties
         that are used to determine how to collapse individual search results. Results are collapsed into one or
         a specified number of results if they match any of the individual collapse specifications.
         Within a single collapse specification, results will be collapsed if their properties match
         all of the individual properties in the collapse specification.
     :param str or None client_type: represents the place where the search query is sent from
     :param bool or None enable_query_rules: Specifies whether query rules are included when a search query is
         executed. If the value is true, query rules are applied to the search query. If the value is false,
         query rules MUST NOT be applied in the search query.
     :param str or None source_id: Specifies the unique identifier for result source to use for executing the
         search query. If no value is specified then the protocol server MUST use the id for the default
         result source.
     """
     super(SearchRequest, self).__init__()
     self.Querytext = query_text
     self.SelectProperties = StringCollection(select_properties)
     self.ClientType = client_type
     self.CollapseSpecification = collapse_specification
     self.Culture = culture
     self.EnableSorting = enable_sorting
     self.SortList = ClientValueCollection(Sort, sort_list)
     self.TrimDuplicates = trim_duplicates
     self.RankingModelId = ranking_model_id
     self.RowLimit = row_limit
     self.RowsPerPage = rows_per_page
     self.QueryTemplate = query_template
     self.SummaryLength = summary_length
     self.StartRow = start_row
     self.EnableQueryRules = enable_query_rules
     self.SourceId = source_id
     self.__dict__.update(**kwargs)
コード例 #23
0
 def roles(self):
     """The type of permission, e.g. read. See below for the full list of roles. Read-only."""
     return self.properties.get('roles', StringCollection())
コード例 #24
0
    def user_tags(self):
        """Links for opening the page. The oneNoteClientURL link opens the page in the OneNote native client
        if it 's installed. The oneNoteWebUrl link opens the page in OneNote on the web. Read-only.

        """
        return self.properties.get("userTags", StringCollection())
コード例 #25
0
 def choices(self):
     """
     Specifies values that are available for selection in the field
     """
     return self.properties.get('Choices', StringCollection())
コード例 #26
0
 def __init__(self, language_codes=None):
     """
     :param list[str] language_codes:
     """
     self.LanguageCodes = StringCollection(language_codes)
コード例 #27
0
 def language_tags(self):
     """List of languages for the term store."""
     return self.properties.get("languageTags", StringCollection())
コード例 #28
0
 def business_phones(self):
     """String collection	The telephone numbers for the user. NOTE: Although this is a string collection,
     only one number can be set for this property. Read-only for users synced from on-premises directory.
     """
     return self.properties.get('businessPhones', StringCollection())
コード例 #29
0
 def untranslated_languages(self):
     return self.properties.get("UntranslatedLanguages", StringCollection())
コード例 #30
0
 def other_mails(self):
     """A list of additional email addresses for the user;
     for example: ["*****@*****.**", "*****@*****.**"]. Supports $filter.
     """
     return self.properties.get('otherMails', StringCollection())