Office365-rest-python-client: ๋ชจ๋“  ์‚ฌ์ดํŠธ ๊ฐ€์ ธ ์˜ค๊ธฐ

์— ๋งŒ๋“  2020๋…„ 12์›” 03์ผ  ยท  5์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: vgrem/Office365-REST-Python-Client

์•ˆ๋…•ํ•˜์„ธ์š”, API์—์„œ ๋ชจ๋“  ์‚ฌ์ดํŠธ๋ฅผ ๊ฐ€์ ธ ์˜ค๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๊นŒ?

URL์ด์žˆ๋Š” ์‚ฌ์ดํŠธ์— ์•ก์„ธ์Šค ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ URL์ด์žˆ๋Š” ์‚ฌ์ดํŠธ ๋ชฉ๋ก์„ ๊ฐ€์ ธ ์™€์„œ ๋ฐ˜๋ณต ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

์ •๋ง ๊ณ ๋ง™์Šต๋‹ˆ๋‹ค

question

๋ชจ๋“  5 ๋Œ“๊ธ€

์•ˆ๋…•ํ•˜์„ธ์š”,์ด ์ฃผ์ œ์— ๋Œ€ํ•œ ๋‰ด์Šค๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ? ์•„๋‹ˆ๋ฉด ๋ช‡ ๊ฐ€์ง€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•? ์„œ๋‘๋ฅด์ง€ ๋ง๊ณ  ํ˜ธ๊ธฐ์‹ฌ ๋งŒ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ^^

์•ผ,

์–‘์ˆ˜, ์˜ˆ๋ฅผ ๋“ค์–ด 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'))

์˜ˆ, ์ด์ œ ํšจ๊ณผ์ ์œผ๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. ์ •๋ง ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰