New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get all sites #301
Comments
Hi, do you have news on this topic? Or some workaround? No hurries only curiosity Thank you ^^ |
Hey, positive, it is supported to retrieve all sites(site collections) within tenant, for example via method Example The example demonstrates how to retrieve all sites within tenant and prints its url: from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.tenant.administration.site_properties import SiteProperties
from office365.sharepoint.tenant.administration.tenant import Tenant
from settings import settings
credentials = UserCredential(username, password)
admin_client = ClientContext("https://{tenant-prefix}-admin.sharepoint.com/").with_credentials(credentials)
tenant = Tenant(admin_client)
result = tenant.get_site_properties_from_sharepoint_by_filters("", 0).execute_query()
for siteProps in result: # type: SiteProperties
print(siteProps.get_property('Url')) |
Hi @vgrem thank you for the code but, sadly, im not getting the url only None, None, None... but i can access with my credentials to the list of sites on sharepoint, hence i dont think the problem be my permissions. Do you know what could be the problem? |
@oktorok ahh, it might the case with Could you give it another shot with this syntax instead:
|
Yes, effectively now its working, thank you so much. |
Hi, there is a method for get all sites from the API?
I can access to a site with url, but would be possible to get a list of sites with the url and iterate it?
Thank you so much
The text was updated successfully, but these errors were encountered: