์๋ ํ์ธ์, API์์ ๋ชจ๋ ์ฌ์ดํธ๋ฅผ ๊ฐ์ ธ ์ค๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
URL์ด์๋ ์ฌ์ดํธ์ ์ก์ธ์ค ํ ์ ์์ง๋ง URL์ด์๋ ์ฌ์ดํธ ๋ชฉ๋ก์ ๊ฐ์ ธ ์์ ๋ฐ๋ณต ํ ์ ์์ต๋๊น?
์ ๋ง ๊ณ ๋ง์ต๋๋ค
์๋ ํ์ธ์,์ด ์ฃผ์ ์ ๋ํ ๋ด์ค๊ฐ ์์ต๋๊น? ์๋๋ฉด ๋ช ๊ฐ์ง ํด๊ฒฐ ๋ฐฉ๋ฒ? ์๋๋ฅด์ง ๋ง๊ณ ํธ๊ธฐ์ฌ ๋ง ๊ฐ์ฌํฉ๋๋ค ^^
์ผ,
์์, ์๋ฅผ ๋ค์ด Tenant.get_site_properties_from_sharepoint_by_filters(filter, start_index=0, include_detail)
๋ฉ์๋๋ฅผ ํตํด ํ
๋ํธ ๋ด์ ๋ชจ๋ ์ฌ์ดํธ (์ฌ์ดํธ ๋ชจ์)๋ฅผ ๊ฒ์ ํ ์ ์์ต๋๋ค.
์
์ด ์์ ๋ ํ ๋ํธ ๋ด์ ๋ชจ๋ ์ฌ์ดํธ๋ฅผ ๊ฒ์ํ๊ณ ํด๋น 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'))
์๋ ํ์ธ์ @ vgrem ์ฝ๋์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.ํ์ง๋ง ์ฌํ๊ฒ๋ URL์ ์์, ์์, ์์ ...ํ์ง๋ง ๋ด ์๊ฒฉ ์ฆ๋ช ์ผ๋ก SharePoint์ ์ฌ์ดํธ ๋ชฉ๋ก์ ์ก์ธ์ค ํ ์ ์์ผ๋ฏ๋ก ๋ฌธ์ ๊ฐ ๋ด ๊ถํ์ด๋ผ๊ณ ์๊ฐํ์ง ์์ต๋๋ค. . ๋ฌด์์ด ๋ฌธ์ ์ธ์ง ์๊ณ ์์ต๋๊น?
@oktorok ahh, get_property
์๋ฏธ ์ฒด๊ณ๊ฐ ์ต๊ทผ์ ๋ณ๊ฒฝ๋์์ผ๋ฏ๋ก siteProps.get_property('Url')
์ ๊ฒฝ์ฐ ์ผ ์ ์์ต๋๋ค.
๋์ ๋ค์ ๊ตฌ๋ฌธ์ผ๋ก ๋ค์ ์๋ํด ์ฃผ์๊ฒ ์ต๋๊น?
print(siteProps.properties.get('Url'))
์, ์ด์ ํจ๊ณผ์ ์ผ๋ก ์๋ํฉ๋๋ค. ์ ๋ง ๊ฐ์ฌํฉ๋๋ค.