{"id":699,"date":"2023-07-07T16:28:39","date_gmt":"2023-07-07T07:28:39","guid":{"rendered":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=699"},"modified":"2023-07-14T09:08:53","modified_gmt":"2023-07-14T00:08:53","slug":"ms-graph%e3%81%a7%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e8%bf%bd%e5%8a%a0%e3%81%a8%e3%83%a9%e3%82%a4%e3%82%bb%e3%83%b3%e3%82%b9%e4%bb%98%e4%b8%8e","status":"publish","type":"post","link":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=699","title":{"rendered":"MS Graph\u3067\u30e6\u30fc\u30b6\u30fc\u8ffd\u52a0\u3068\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e"},"content":{"rendered":"\n<p>\u307e\u305f\u307e\u305f\u3001MS Graph\u306e\u8a71\u3067\u7533\u3057\u8a33\u306a\u3044\u306e\u3060\u304c\u3001\u30c1\u30e7\u30c3\u30c8\u5d4c\u3063\u305f\u70b9\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u30e1\u30e2\u3002<\/p>\n\n\n\n<p>MS Graph\u3092\u4f7f\u7528\u3057\u3066\u3001Office365\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u52a0\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u307f\u305f\u3002MS\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u6642\u306b\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u4ed8\u4e0e\u3067\u304d\u308b\u3068\u3082\u3001\u3067\u304d\u306a\u3044\u3068\u3082\u66f8\u3044\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u4e00\u5fdc\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u304d\u3067\u8a66\u3057\u3066\u307f\u305f\u304c\u3001NG\u3002(Bing AI\u541b\u306b\u805e\u3044\u3066\u307f\u305f\u3089\u3001\u300c\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u6642\u306b\u306f\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u3067\u304d\u307e\u305b\u3093\u3002\u300d\u3068\u8a00\u308f\u308c\u305f\u3002\u300c\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u30cf\u30c3\u30ad\u30ea\u3068\u306f\u66f8\u3044\u3066\u3042\u308a\u307e\u305b\u3093\u304c\u30fb\u30fb\u30fb\u300d\u3060\u3068\u3002AI\u541b\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b\u306f\u5206\u304b\u3089\u3093\u304c\u3002)<\/p>\n\n\n\n<p>\u4ed5\u65b9\u304c\u306a\u3044\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u8ffd\u52a0\u3057\u3066\u304b\u3089\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u4ed8\u4e0e\u3059\u308b\u5f62\u306b\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u52d5\u4f5c\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-csharp\" data-file=\"\u30e6\u30fc\u30b6\u30fc\u8ffd\u52a0\u3068\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\" data-lang=\"C#\"><code>\/\/\n\/\/ \u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210\u3068\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\n\/\/ \u3069\u3046\u3082\u3001\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u6642\u306b\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3088\u3046\u3060\u3002\n\/\/\t(\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u660e\u8a18\u3055\u308c\u3066\u3044\u306a\u3044\u3088\u3046\u3060\u304c\u30fb\u30fb\u30fb)\n\/\/ \u4ed5\u65b9\u306a\u3044\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u3001\u305d\u306e\u5f8c\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u3068\u3059\u308b\u3002\n\/\/ \u3061\u306a\u307f\u306b\u3001\u3053\u3061\u3089\u3082\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u66f8\u304b\u308c\u3066\u3044\u306a\u3044\u304c\u3001\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u6642\u306b\u306fUsageLocation\u3068\n\/\/ PreferredLanguage\u306f\u5fc5\u9808!\n\/\/ \u3053\u308c\u304c\u306a\u3044\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u3092Enable\u306b\u3067\u304d\u306a\u3044\u3057\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u3082\u3067\u304d\u306a\u3044\u3002\n\/\/\nvar cred = new UsernamePasswordCredential(ManageUser,ManagePass,TenantID,AppID,options);\nvar cli = new GraphServiceClient(cred);\n\nvar request = new User() {\n    UserPrincipalName = &quot;boo@foo.com&quot;,\n    MailNickname = &quot;boo&quot;,\n    AccountEnabled = true,\n    DisplayName = &quot;Boo.Foo(Mr.Boo)&quot;,\n    Surname = &quot;Foo&quot;,\n    GivenName = &quot;Boo&quot;,\n    PasswordProfile = new PasswordProfile() {\n        Password = MakePassword(),\n        ForceChangePasswordNextSignIn = true\n    },\n    UsageLocation = &quot;JP&quot;,\t\/\/ \u5fc5\u9808!\n    PreferredLanguage = &quot;ja-JP&quot;,\t\/\/ \u5fc5\u9808!\n};\nvar res = await cli.Users.PostAsync(request);\n\n\/\/ \u30e6\u30fc\u30b6\u30fc\u8ffd\u52a0\u8981\u6c42\u5f8c\u3059\u3050\u306b\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u3092\u884c\u304a\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u306e\u3067\u3001\n\/\/ \u3068\u308a\u3042\u3048\u305a\u30011\u79d2\u7a0b\u307e\u3063\u3066\u304b\u3089\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u3002\nThread.Sleep(1000);\nvar licreq = new Microsoft.Graph.Users.Item.AssignLicense.AssignLicensePostRequestBody() {\n    AddLicenses = new List&lt;AssignedLicense&gt;() {\n        new AssignedLicense() {\n            DisabledPlans = new(),  \/\/ \u2190\u3053\u308c\u306f\u7121\u304f\u3066\u3082\u5927\u4e08\u592b\n            SkuId = Guid.Parse(&quot;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&quot;)\n        }\n    },\n    RemoveLicenses = new()  \/\/ \u2190\u524a\u9664\u3059\u308b\u30e9\u30a4\u30bb\u30f3\u30b9\u304c\u7121\u304f\u3066\u3082\u7a7a\u914d\u5217\u304c\u5fc5\u8981\u306a\u3088\u3046\u3060\u3002\n};\nawait cli.Users[&quot;boo@foo.com&quot;].AssignLicense.PostAsync(licreq);<\/code><\/pre><\/div>\n\n\n\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u30b3\u30e1\u30f3\u30c8\u306b\u3082\u66f8\u3044\u3066\u3044\u308b\u304c\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u5c5e\u6027\u3068\u3057\u3066\u3001UsageLocation\u3068PreferredLanguage\u306f\u5fc5\u9808\u3002(MS\u306eGraph API\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u66f8\u3044\u3066\u306a\u3044)<\/p>\n\n\n\n<p>\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u306e\u65b9\u3060\u304c\u3001MS\u306e\u30b5\u30f3\u30d7\u30eb\u306fMe.AssignLicense.PostAsync\u3092\u4f7f\u7528\u3057\u305f\u4f8b\u306e\u307f\u304c\u8f09\u3063\u3066\u3044\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u6307\u5b9a\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u306e\u4f8b\u306f\u8f09\u3063\u3066\u3044\u306a\u304b\u3063\u305f\u306e\u3060\u304c\u3001\u4f7f\u7528\u3059\u308bRequestBody\u306e\u30af\u30e9\u30b9\u540d\u304c\u7570\u306a\u308b\u3060\u3051\u3067\u3001\u5185\u5bb9\u306f\u540c\u3058\u3088\u3046\u3060\u3002<\/p>\n\n\n\n<p>AddLicenses\u306fAssignedLicense\u30af\u30e9\u30b9\u306e\u30ea\u30b9\u30c8\u3067\u3001\u3053\u3053\u306b\u4ed8\u4e0e\u3059\u308b\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u5217\u6319\u3059\u308b\u3002\u591a\u5206\u3001DisabledPlans\u306f\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u307b\u307c\u306a\u3044\u3060\u308d\u3046\u3068\u601d\u308f\u308c\u308b\u3002SkuId\u306f\u30e9\u30a4\u30bb\u30f3\u30b9\u306eSkuId(<a rel=\"noreferrer noopener\" href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=686\" target=\"_blank\">\u4ee5\u524d\u306e\u8a18\u4e8b<\/a>\u3067\u53d6\u5f97\u3067\u304d\u308b\u3001SubscribedSku\u30af\u30e9\u30b9\u306e\u30e1\u30f3\u30d0\u30fc)\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n\n\n\n<p>\u3082\u3061\u308d\u3093\u3001\u8907\u6570\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001RemoveLicense\u306f\u4ed8\u4e0e\u3055\u308c\u3066\u3044\u308b\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u524a\u9664\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3060\u304c\u3001\u3082\u3061\u308d\u3093\u3001\u4eca\u56de\u306f\u4f7f\u7528\u3057\u306a\u3044(\u3068\u3044\u3046\u304b\u524a\u9664\u3059\u308b\u30e9\u30a4\u30bb\u30f3\u30b9\u304c\u7121\u3044)\u3002\u524a\u9664\u3059\u308b\u30e9\u30a4\u30bb\u30f3\u30b9\u304c\u7121\u304f\u3066\u3082\u3001\u7a7a\u914d\u5217(C#\u4e0a\u306fList\u3060\u304c)\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u5b9f\u884c\u6642\u30a8\u30e9\u30fc\u3068\u306a\u308b\u3002(\u3053\u3053\u3082\u5d4c\u307e\u3063\u305f\u70b9)<\/p>\n\n\n\n<p>\u5f8c\u306fcli.Users[UserPrincipalName].AssignLicense.PostAsync()\u306b\u4f5c\u6210\u3057\u305f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6e21\u305b\u3070\u3001\u30e9\u30a4\u30bb\u30f3\u30b9\u304c\u4ed8\u4e0e\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u30b3\u30e1\u30f3\u30c8\u306b\u66f8\u3044\u305f\u3088\u3046\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u21d2\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u3092Delay\u7121\u3057\u3067\u884c\u306a\u3046\u3068\u3001\u5b9f\u884c\u6642\u30a8\u30e9\u30fc\u3068\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002\u3068\u308a\u3042\u3048\u305a\u30011\u79d2\u7f6e\u3044\u3066\u304b\u3089\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e\u3092\u3057\u3066\u3044\u308b\u304c\u3001\u5b9f\u969b\u306e\u6240\u3001\u3069\u306e\u7a0b\u5ea6\u306e\u6642\u9593\u304c\u5fc5\u8981\u306a\u306e\u304b\u306f\u4e0d\u660e\u3002\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u3092\u5225\u30b9\u30ec\u30c3\u30c9\u3067\u691c\u7d22\u3057\u3066\u691c\u7d22OK\u307e\u3067\u5f85\u3064\u3088\u3046\u306a\u51e6\u7406\u304c\u5fc5\u8981\u304b\u3082\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001\u5fc5\u8981\u306a\u7279\u6a29\u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u4e0a\u306f\u4e0b\u8a18\u3068\u306a\u308b\u3002\u4f7f\u7528\u3057\u3066\u3044\u308bAzure\u30a2\u30d7\u30ea\u306b\u306f\u8272\u3005\u3068\u7279\u6a29\u4ed8\u3051\u3066\u3044\u308b\u306e\u3067\u3001\u672c\u5f53\u306b\u3053\u308c\u3060\u3051\u3067\u5927\u4e08\u592b\u304b\u5206\u304b\u3089\u3093\u304c\u30fb\u30fb\u30fb<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>User.ReadWrite.All<\/li>\n\n\n\n<li>Directory.ReadWriteAll<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u307e\u305f\u307e\u305f\u3001MS Graph\u306e\u8a71\u3067\u7533\u3057\u8a33\u306a\u3044\u306e\u3060\u304c\u3001\u30c1\u30e7\u30c3\u30c8\u5d4c\u3063\u305f\u70b9\u304c\u3042\u3063\u305f\u306e\u3067\u3001 &hellip; <a href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=699\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,9,16,4],"tags":[],"class_list":["post-699","post","type-post","status-publish","format-standard","hentry","category-net","category-c","category-microsoft-graph","category-4"],"_links":{"self":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=699"}],"version-history":[{"count":6,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/699\/revisions"}],"predecessor-version":[{"id":705,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/699\/revisions\/705"}],"wp:attachment":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}