{"id":2560,"date":"2017-07-26T02:04:16","date_gmt":"2017-07-25T17:04:16","guid":{"rendered":"http:\/\/1bed.allright.life\/?p=2560"},"modified":"2020-04-18T20:24:51","modified_gmt":"2020-04-18T11:24:51","slug":"post-2560","status":"publish","type":"post","link":"https:\/\/1bed.allright.life\/?p=2560","title":{"rendered":"\u53c2\u7167\u5217\u306e\u53c2\u7167\u5148\u30ea\u30b9\u30c8\u3092\u5909\u66f4\u3057\u305f\u3044"},"content":{"rendered":"<p>\u30ea\u30b9\u30c8\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5316\u3057\u3066\u3044\u305f\u3082\u306e\u3092\u5225\u30b5\u30a4\u30c8\u306b\u5c55\u958b\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u53c2\u7167\u5217\u3092\u542b\u3093\u3067\u3044\u308b\u3053\u3068\u3092\u5fd8\u308c\u3066\u3044\u3066\u3001\u53c2\u7167\u5217\u304c\u9078\u629e\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f&#8230;<\/p>\n<p>GUI \u304b\u3089\u306f\u53c2\u7167\u5143\u30ea\u30b9\u30c8\u3092\u5909\u63db\u3067\u304d\u306a\u3044\u3088\u3046\u306a\u306e\u3067\u3001\u5217\u306e SchemaXml \u3092\u773a\u3081\u3066\u3044\u305f\u3089\u5909\u66f4\u3067\u304d\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/1bed.allright.life\/?p=2460\">SchemaXml \u3092\u773a\u3081\u65b9\u306f\u3053\u3061\u3089<\/a><\/p>\n<h2>\u53c2\u7167\u5217\u306e SchemaXml \u3092\u78ba\u8a8d<\/h2>\n<p>\u8a66\u3057\u306b\u30ea\u30b9\u30c8\u3092\u4f5c\u3063\u3066\u3001\u5225\u30ea\u30b9\u30c8\u306e\u300c\u4f5c\u6210\u65e5\u6642\u300d\u3092\u5229\u7528\u3057\u3066\u53c2\u7167\u5217\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/1bed.allright.life\/wp-content\/uploads\/2017\/07\/lookup01.png\" alt=\"http:\/\/1bed.allright.life\/wp-content\/uploads\/2017\/07\/lookup01-300x195.png\" \/><\/p>\n<p>\u305d\u306e SchemaXml \u304c\u3053\u3061\u3089\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-xml\">&lt;Field\n    Type=&quot;Lookup&quot;\n    DisplayName=&quot;\u53c2\u7167(\u65e5\u4ed8\u3068\u6642\u523b)&quot;\n    Required=&quot;FALSE&quot;\n    EnforceUniqueValues=&quot;FALSE&quot;\n    List=&quot;{f5bb4f52-e0a7-4c25-abab-a3d261fde470}&quot;\n    ShowField=&quot;Created&quot;\n    UnlimitedLengthInDocumentLibrary=&quot;FALSE&quot;\n    RelationshipDeleteBehavior=&quot;None&quot;\n    ID=&quot;{55843724-0221-4ae3-ad18-414edd209754}&quot;\n    SourceID=&quot;{aca9e366-bd2b-4060-bd63-342e18395df7}&quot;\n    StaticName=&quot;testLookupDatetime&quot;\n    Name=&quot;testLookupDatetime&quot;\n    ColName=&quot;int3&quot;\n    RowOrdinal=&quot;0&quot;\n    Version=&quot;2&quot;\n    Group=&quot;&quot; \/&gt;<\/code><\/pre>\n<p>\u3053\u306e\u4e2d\u306b 36 \u6587\u5b57\u306e\u82f1\u6570\u5b57\u3068\u30cf\u30a4\u30d5\u30f3\u3067\u3067\u304d\u305f\u6587\u5b57\u5217\u3092 {} \u3067\u56f2\u3063\u3066\u3044\u308b GUID \u304c 3 \u3064\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n<p>List=&quot;{f5bb4f52-e0a7-4c25-abab-a3d261fde470}&quot;<br \/>\n\u53c2\u7167\u5143\u30ea\u30b9\u30c8\u306e\u30ea\u30b9\u30c8 ID<\/p>\n<\/li>\n<li>\n<p>ID=&quot;{55843724-0221-4ae3-ad18-414edd209754}&quot;<br \/>\n\u5217\u56fa\u6709\u306e ID<\/p>\n<\/li>\n<li>\n<p>SourceID=&quot;{aca9e366-bd2b-4060-bd63-342e18395df7}&quot;<br \/>\n\u3053\u306e\u5217\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u30ea\u30b9\u30c8\u306e\u30ea\u30b9\u30c8 ID<\/p>\n<\/li>\n<\/ul>\n<p>\u53c2\u7167\u3057\u3066\u3044\u308b\u5217\u306e\u5185\u90e8\u540d <code>ShowField=&quot;Created&quot;<\/code> \u3092\u5408\u308f\u305b\u3066\u3001List \u5c5e\u6027\u306e\u5024\u3092\u66f8\u304d\u63db\u3048\u308c\u3070\u3069\u3046\u306b\u304b\u306a\u308b\u306e\u3067\u306f\uff1f\u3068\u601d\u3044\u8a66\u3057\u3066\u307e\u3057\u305f\u3002<\/p>\n<h2>SchemaXml \u306e List \u5c5e\u6027\u3092 PowerShell \u3067\u66f8\u304d\u63db\u3048\u308b<\/h2>\n<p>\u4e0b\u8a18\u72b6\u614b\u3068\u4eee\u5b9a\u3057\u3066\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u307e\u3059<\/p>\n<ul>\n<li>\u30e6\u30fc\u30b6\u30fc<br \/>\nmiyamiya@example.com<\/li>\n<li>SharePoint Online \u306e URL<br \/>\nhttps:\/\/<tenant>.sharepoint.com\/sites\/example<\/li>\n<li>\u53c2\u7167\u5217\u306e\u3042\u308b\u30ea\u30b9\u30c8\u540d<br \/>\n\u53c2\u7167\u5217\u6301\u3063\u3066\u308b\u305c\u30ea\u30b9\u30c8<\/li>\n<li>\u53c2\u7167\u5217\u306e\u5185\u90e8\u540d<br \/>\nLookupDate<\/li>\n<li>\u53c2\u7167\u5143\u306e\u30ea\u30b9\u30c8\u540d<br \/>\n\u79c1\u3092\u898b\u3066\u30ea\u30b9\u30c8<\/li>\n<\/ul>\n<pre><code class=\"language-powershell\">[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# \u53d6\u5f97\u3059\u308b SharePoint Online \u306e URL\n$url = &#039;https:\/\/&lt;tenant&gt;.sharepoint.com\/sites\/example&#039;\n\n# \u30e6\u30fc\u30b6\u30fc\u540d\n$user = &#039;miyamiya@example.com&#039;;\n\n# \u30d1\u30b9\u30ef\u30fc\u30c9\n$secure = Read-Host -Prompt &quot;Enter the password for ${user}(Office365)&quot; -AsSecureString;\n\n# SharePoint Online \u8a8d\u8a3c\u60c5\u5831\n$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($user, $secure);\n\n# SharePoint Client Context \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\n$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)\n$ctx.Credentials = $credentials<\/code><\/pre>\n<p>\u3053\u3053\u307e\u3067\u306f\u3044\u3064\u3082\u306e\u304a\u307e\u3058\u306a\u3044\u7684\u306a\u30b3\u30fc\u30c9\u3002<br \/>\n\u30ed\u30b0\u30a4\u30f3\u3057\u3066 SharePoint Client Context \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u304b\u3089\u304c\u672c\u547d\u306e\u30b3\u30fc\u30c9\u3002<\/p>\n<pre><code class=\"language-powershell\"># \u66f4\u65b0\u30ea\u30b9\u30c8\u540d\n$targetListName   = &#039;\u53c2\u7167\u5217\u6301\u3063\u3066\u308b\u305c\u30ea\u30b9\u30c8&#039;;\n# \u66f4\u65b0\u5217\n$targetFields     = @(&#039;LookupDate&#039;);\n# \u65b0\u53c2\u7167\u5148\u30ea\u30b9\u30c8\u540d\n$toLookupListName = &#039;\u79c1\u3092\u898b\u3066\u30ea\u30b9\u30c8&#039;\n\n# \u65b0\u53c2\u7167\u5148\u30ea\u30b9\u30c8 ID \u53d6\u5f97\n$toList = $ctx.Web.Lists.GetByTitle($toLookupListName)\n$ctx.Load($toList)\n\n# \u66f4\u65b0\u5217\u306e\u8aad\u307f\u8fbc\u307f\u4e88\u7d04\n$fieldsContainer = @()\nforeach($fieldName in $targetFields) {\n    $field = $ctx.Web.Lists.GetByTitle($targetListName).Fields.GetByInternalNameOrTitle($fieldName)\n    $ctx.Load($field)\n    $fieldsContainer += $field\n}\n\n# \u8aad\u307f\u8fbc\u307f\u5b9f\u884c\n$ctx.ExecuteQuery()\n\n# \u53c2\u7167\u5148\u30ea\u30b9\u30c8\u306e\u66f8\u304d\u63db\u3048\nforeach($field in $fieldsContainer) {\n    # SchemaXml \u306e List \u5c5e\u6027\u306e\u5024\u3092\u3001\u65b0\u53c2\u7167\u5148\u30ea\u30b9\u30c8\u306e\u30ea\u30b9\u30c8 ID \u306b\u66f8\u304d\u63db\u3048\n    $field.SchemaXml = $field.SchemaXml -replace &#039;List=&quot;(.*?)&quot;&#039;, (&#039;List=&quot;{&#039;+ $toList.Id + &#039;}&quot;&#039;)\n}\n\n# \u66f8\u304d\u63db\u3048\u5b9f\u884c\n$ctx.ExecuteQuery()<\/code><\/pre>\n<p>\u5b9f\u969b\u306b\u306f\u3082\u3046\u3061\u3087\u3063\u3068\u7dba\u9e97\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3057\u3066\u307e\u3059\u304c(\u8a00\u3044\u8a33\u6c17\u5473)<\/p>\n<h2>\u8003\u5bdf<\/h2>\n<p>\u4e00\u5fdc\u624b\u5143\u3067\u306f\u52d5\u3044\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u3067\u3044\u3044\u306e\u304b\uff1f\u3068\u3044\u3046\u7591\u554f\u3068\u3001\u3057\u304f\u3058\u3063\u305f\u3089\u53d6\u308a\u8fd4\u3057\u306e\u3064\u304b\u306a\u3044\u3053\u3068\u306b\u306a\u308a\u305d\u3046\u306a\u306e\u3067\u3001\u53c2\u8003\u306b\u3059\u308b\u5947\u7279\u306a\u65b9\u304c\u3044\u307e\u3057\u305f\u3089\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u3063\u3066\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u307e\u3059<br \/>\n_(:3\uff63\u2220)_<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ea\u30b9\u30c8\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5316\u3057\u3066\u3044\u305f\u3082\u306e\u3092\u5225\u30b5\u30a4\u30c8\u306b\u5c55\u958b\u3057\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u53c2\u7167\u5217\u3092\u542b\u3093\u3067\u3044\u308b\u3053\u3068\u3092\u5fd8\u308c\u3066\u3044\u3066\u3001\u53c2\u7167\u5217\u304c\u9078\u629e\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f&#8230; GUI \u304b\u3089\u306f\u53c2\u7167\u5143\u30ea\u30b9\u30c8\u3092\u5909\u63db\u3067\u304d\u306a\u3044\u3088\u3046\u306a\u306e\u3067\u3001\u5217\u306e Sc [&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-2560","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\/2560","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=2560"}],"version-history":[{"count":5,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2560\/revisions"}],"predecessor-version":[{"id":3120,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2560\/revisions\/3120"}],"wp:attachment":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}