{"id":2451,"date":"2017-04-16T18:09:07","date_gmt":"2017-04-16T09:09:07","guid":{"rendered":"http:\/\/1bed.allright.life\/?p=2451"},"modified":"2020-04-18T20:44:54","modified_gmt":"2020-04-18T11:44:54","slug":"post-2451","status":"publish","type":"post","link":"https:\/\/1bed.allright.life\/?p=2451","title":{"rendered":"PowerShell \u3067 SharePoint Online \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u305f\u30e1\u30e2"},"content":{"rendered":"<p>\u3057\u3047\u3042\u307d\u3044\u3093\u3068\u3055\u3093\u3068\u4ef2\u826f\u304f\u306a\u308b\u305f\u3081\u306b\u3001\u307e\u305a\u306f Windows \u3067\u306f\u4e00\u756a\u6163\u308c\u3066\u3044\u308b PowerShell \u3092\u4f7f\u3063\u3066 SharePoint Online \u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u305f\u30e1\u30e2\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Windows 10 Pro<\/li>\n<li>PowerShell 5.1<\/li>\n<\/ul>\n<h2>\u4e8b\u524d\u6e96\u5099<\/h2>\n<p>SharePoint Online \u7528\u306e SDK \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>SharePoint Online Client Components SDK \u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=42038\">https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=42038)<\/a><br \/>\n\u203b64 bit \u3068 32 bit \u3092\u9593\u9055\u308f\u306a\u3044\u3088\u3046\u306b<\/li>\n<\/ul>\n<h2>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n<p>\u30e6\u30fc\u30b6\u30fc\u304c miyamiya@example.com\u3001SharePoint Online \u306e URL \u304c <a href=\"https:\/\/&amp;lt;tenant&gt;.sharepoint.com\/sites\/example\/SitePages\/Home.aspx\">https:\/\/&lt;tenant>.sharepoint.com\/sites\/example\/SitePages\/Home.aspx<\/a> \u3068\u4eee\u5b9a\u3057\u3066\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u66f8\u304f\u3002<\/p>\n<pre><code class=\"language-powershell\"># SDK \u306e\u8aad\u307f\u8fbc\u307f\n[System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.SharePoint.Client&quot;) | Out-Null\n[System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.SharePoint.Client.Runtime&quot;) | Out-Null\n\n# \u30a2\u30af\u30bb\u30b9\u3059\u308b URL\n$url  = &#039;https:\/\/&lt;tenant&gt;.sharepoint.com\/sites\/example\/SitePages\/Home.aspx&#039;\n\n# \u30e6\u30fc\u30b6\u30fc\u540d\n$user = &#039;miyamiya@example.com&#039;\n\n# \u30d1\u30b9\u30ef\u30fc\u30c9\u306f\u90fd\u5ea6\u5165\u529b\n$secure = Read-Host -Prompt &quot;Enter the password&quot; -AsSecureString\n\n# \u8a8d\u8a3c\u60c5\u5831\u751f\u6210\n$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($user, $secure)\n\n# WebRequest \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\n$request = [System.Net.WebRequest]::Create($url)\n\n# \u5404\u7a2e\u8a2d\u5b9a\n$request.Credentials = $credentials\n$request.Headers.Add(&quot;X-FORMS_BASED_AUTH_ACCEPTED&quot;, &quot;f&quot;)\n$request.Accept = &quot;application\/json;odata=verbose&quot;\n$request.Method = [Microsoft.PowerShell.Commands.WebRequestMethod]::Get\n\n# \u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u53d6\u5f97\n$response = $request.GetResponse()\n\n# \u30b9\u30c8\u30ea\u30fc\u30e0\u30c7\u30fc\u30bf\u53d6\u5f97\n$readStream = New-Object System.IO.StreamReader ($response.GetResponseStream())\n\n# \u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u8868\u793a\n$readStream.ReadToEnd()<\/code><\/pre>\n<h2>\u8003\u5bdf<\/h2>\n<p>REST API \u3092\u53e9\u3044\u3066 JSON \u3092\u8fd4\u3059\u30b5\u30f3\u30d7\u30eb\u3092\u53c2\u8003\u306b\u3057\u307e\u3057\u305f\u304c\u3001\u5225\u306b REST API \u3092\u53e9\u304d\u305f\u3044\u308f\u3051\u3067\u306f\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u30a2\u30af\u30bb\u30b9\u3057\u305f\u753b\u9762\u3092 HTML \u3067\u4fdd\u5b58\u3059\u308b\u3060\u3051\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u6050\u3089\u304f\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f7f\u3046\u306e\u306f\u3042\u307e\u308a\u826f\u304f\u306a\u3044\u306e\u3060\u308d\u3046\u3051\u3069\u3001\u4e00\u822c\u30e6\u30fc\u30b6\u30fc\u3067\u306f\u3053\u306e\u65b9\u6cd5\u3057\u304b\u306a\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u306a\uff1f\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.itunity.com\/article\/sharepoint-rest-service-windows-powershell-1381\">Using the SharePoint REST Service with Windows PowerShell<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u3057\u3047\u3042\u307d\u3044\u3093\u3068\u3055\u3093\u3068\u4ef2\u826f\u304f\u306a\u308b\u305f\u3081\u306b\u3001\u307e\u305a\u306f Windows \u3067\u306f\u4e00\u756a\u6163\u308c\u3066\u3044\u308b PowerShell \u3092\u4f7f\u3063\u3066 SharePoint Online \u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u305f\u30e1\u30e2\u3002 \u74b0\u5883 Windows 10 Pro Powe [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,111],"tags":[62],"class_list":["post-2451","post","type-post","status-publish","format-standard","hentry","category-program","category-sharepoint","tag-powershell"],"_links":{"self":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2451"}],"version-history":[{"count":6,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2451\/revisions"}],"predecessor-version":[{"id":3130,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2451\/revisions\/3130"}],"wp:attachment":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}