{"id":2489,"date":"2012-12-07T16:09:33","date_gmt":"2012-12-07T07:09:33","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=2489"},"modified":"2021-10-25T22:44:36","modified_gmt":"2021-10-25T13:44:36","slug":"%e3%83%89%e3%83%a9%e3%83%83%e3%82%b0%e3%83%89%e3%83%ad%e3%83%83%e3%83%97%e3%81%97%e3%81%9f%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92skydrive%e4%b8%8a%e3%81%ae%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=2489","title":{"rendered":"\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092SkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30a2\u30c3\u30d7\u3059\u308bVBScript"},"content":{"rendered":"<p><span style=\"color: #ff0000; font-weight: bold;\">2012\/12\/19 \u8ffd\u8a18\uff1a<\/span><br \/>\n\u30fb\u95a2\u9023\u8a18\u4e8b\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=2503\" title=\"SkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308bVBScript\" target=\"_blank\" rel=\"noopener\">SkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308bVBScript<\/a>\u300d\u3082\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>Microsoft\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u7121\u6599\u306e\u30aa\u30f3\u30e9\u30a4\u30f3\u30b9\u30c8\u30ec\u30fc\u30b8\u300c<a href=\"http:\/\/windowslive.jp.msn.com\/skydrive.htm\" title=\"\u7121\u6599\u306e\u5927\u5bb9\u91cf\u30aa\u30f3\u30e9\u30a4\u30f3\u30b9\u30c8\u30ec\u30fc\u30b8\u3000SkyDrive - Windows Live on MSN\" target=\"_blank\" rel=\"noopener\">SkyDrive<\/a>\u300d\u306f\u975e\u5e38\u306b\u4fbf\u5229\u3067\u5229\u7528\u3057\u3066\u3044\u308b\u4eba\u3082\u591a\u3044\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f<a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/live\/hh826521.aspx\" title=\"SkyDrive API (Live Connect)\" target=\"_blank\" rel=\"noopener\">SkyDrive API<\/a>\u3092\u5229\u7528\u3057\u3066\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092SkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30a2\u30c3\u30d7\u3059\u308bVBScript\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b SkyDrive\u304c\u5229\u7528\u3067\u304d\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u306e\u3067\u3001Microsoft\u30a2\u30ab\u30a6\u30f3\u30c8(\u65e7Windows Live ID)\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u65b9\u306f\u300c<a href=\"http:\/\/www.microsoft.com\/ja-jp\/mscorp\/account\/default.aspx\" title=\"Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u30db\u30fc\u30e0\" target=\"_blank\" rel=\"noopener\">Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u30db\u30fc\u30e0<\/a>\u300d\u304b\u3089\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p><!--more--><br \/>\n\u307e\u305a\u306f\u3001API\u3092\u5229\u7528\u3059\u308b\u306e\u306b\u5fc5\u8981\u306a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/live\/\" title=\"Live Connect \u30c7\u30d9\u30ed\u30c3\u30d1\u30fc \u30bb\u30f3\u30bf\u30fc\" target=\"_blank\" rel=\"noopener\">Live Connect \u30c7\u30d9\u30ed\u30c3\u30d1\u30fc \u30bb\u30f3\u30bf\u30fc<\/a>\u306e\u4e2d\u304b\u3089\u300c<a href=\"https:\/\/manage.dev.live.com\/?mkt=ja-jp\" title=\"\u30de\u30a4 \u30a2\u30d7\u30ea\" target=\"_blank\" rel=\"noopener\">\u30de\u30a4 \u30a2\u30d7\u30ea<\/a>\u300d\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210<\/span>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01-300x245.png\" alt=\"\" title=\"SkyDriveUp_01\" width=\"300\" height=\"245\" class=\"alignnone size-medium wp-image-2490\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01-300x245.png 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01-1024x839.png 1024w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01-290x237.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01-150x122.png 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_01.png 1033w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u3068\u8a00\u8a9e\u3092\u5165\u529b\u3057\u3066\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u540c\u610f\u3059\u308b<\/span>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02-300x245.png\" alt=\"\" title=\"SkyDriveUp_02\" width=\"300\" height=\"245\" class=\"alignnone size-medium wp-image-2491\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02-300x245.png 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02-1024x839.png 1024w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02-290x237.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02-150x122.png 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_02.png 1033w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>API\u8a2d\u5b9a\u753b\u9762\u304c\u958b\u304b\u308c\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID<\/span>\u300d\u3068\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 \u30b7\u30fc\u30af\u30ec\u30c3\u30c8<\/span>\u300d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID<\/span>\u300d\u306e\u307f\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03-300x245.png\" alt=\"\" title=\"SkyDriveUp_03\" width=\"300\" height=\"245\" class=\"alignnone size-medium wp-image-2492\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03-300x245.png 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03-1024x839.png 1024w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03-290x237.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03-150x122.png 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_03.png 1033w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u3067\u6e96\u5099\u306f\u7d42\u4e86\u3067\u3059\u3002<br \/>\n\u4e0b\u8a18\u30b9\u30af\u30ea\u30d7\u30c8\u5185\u306e\u300c<span style=\"color: #ff0000; font-weight: bold;\">CLIENT_ID<\/span>\u300d\u306e\u5024\u3092\u4e0a\u8a18\u4f5c\u696d\u3067\u53d6\u5f97\u3057\u305f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\u306b\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">FOLDER_NAME<\/span>\u300d\u306e\u5024\u3092\u30a2\u30c3\u30d7\u3057\u305f\u3044SkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u540d\u306b\u66f8\u304d\u63db\u3048\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30c3\u30d7\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u81ea\u52d5\u7684\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u969b\u30b5\u30a4\u30f3\u30a4\u30f3\u3068\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u3092\u6c42\u3081\u3089\u308c\u308b\u306e\u3067\u3001&#8221;<strong>\u30de\u30a4 \u30a2\u30d7\u30ea<\/strong>&#8220;\u767b\u9332\u306b\u4f7f\u7528\u3057\u305fMicrosoft \u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u30b5\u30a4\u30f3\u30a4\u30f3\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04-240x300.png\" alt=\"\" title=\"SkyDriveUp_04\" width=\"240\" height=\"300\" class=\"alignnone size-medium wp-image-2493\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04-240x300.png 240w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04-290x362.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04-120x150.png 120w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_04.png 400w\" sizes=\"auto, (max-width: 240px) 100vw, 240px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05-288x300.png\" alt=\"\" title=\"SkyDriveUp_05\" width=\"288\" height=\"300\" class=\"alignnone size-medium wp-image-2494\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05-288x300.png 288w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05-290x301.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05-144x150.png 144w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_05.png 545w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06-300x146.png\" alt=\"\" title=\"SkyDriveUp_06\" width=\"300\" height=\"146\" class=\"alignnone size-medium wp-image-2495\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06-300x146.png 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06-290x141.png 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06-150x73.png 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/SkyDriveUp_06.png 730w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim Arg\r\nDim Args\r\nDim IE\r\nDim FlgIeQuit\r\nDim ParamGet\r\nDim AccessToken\r\nDim AuthenticationToken\r\nDim ExpiresIn\r\nDim DateExpires\r\n\r\n'---------------------------------------------------------------------\r\n'\u203b \u8981\u5909\u66f4\r\n'---------------------------------------------------------------------\r\nConst FOLDER_NAME = &quot;\u30b5\u30f3\u30d7\u30eb\u30d5\u30a9\u30eb\u30c0\u30fc&quot;\r\n'\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\r\nConst CLIENT_ID = &quot;****************&quot;\r\n'\u30ea\u30c0\u30a4\u30ec\u30af\u30c8 \u30c9\u30e1\u30a4\u30f3(API\u8a2d\u5b9a\u3067\u81ea\u5206\u3067\u30c9\u30e1\u30a4\u30f3\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306e\u307f\u5909\u66f4)\r\nConst REDIRECT_URL = &quot;https:\/\/oauth.live.com\/desktop&quot;\r\n'---------------------------------------------------------------------\r\n\r\nSet Args = WScript.Arguments\r\nIf Args.Count &lt; 1 Then\r\n  MsgBox &quot;SkyDrive\u306b\u30a2\u30c3\u30d7\u3057\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u5f53\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30c9\u30e9\u30c3\u30b0&amp;\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, 16 + 4096\r\n  WScript.Quit\r\nEnd If\r\nInit '\u521d\u671f\u5316\r\nFor Each Arg In Args\r\n  UploadSkyDriveFile Arg\r\nNext\r\nMsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, 64 + 4096\r\n\r\nPrivate Sub Init()\r\n'\u5404\u5909\u6570\u521d\u671f\u5316\r\n  FlgIeQuit = 0\r\n  ParamGet = &quot;&quot;\r\n  AccessToken = &quot;&quot;\r\n  AuthenticationToken = &quot;&quot;\r\n  ExpiresIn = &quot;&quot;\r\n  DateExpires = &quot;&quot;\r\nEnd Sub\r\n\r\nPrivate Sub UploadSkyDriveFile(ByVal filePath)\r\n'SkyDriveFile\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\r\n  Dim fileName\r\n  Dim idFolder\r\n  Dim dat\r\n  \r\n  If (DateExpires &lt;&gt; &quot;&quot;) And (Now() &lt; DateExpires) Then\r\n  Else\r\n    AuthenticateSkyDrive '\u8a8d\u8a3c\r\n  End If\r\n  If AccessToken = &quot;&quot; Then\r\n    MsgBox &quot;\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;, 16 + 4096\r\n    Exit Sub\r\n  End If\r\n  \r\n  '\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u78ba\u8a8d\u30fb\u4f5c\u6210\r\n  idFolder = GetSkyDriveFolderId(AccessToken, FOLDER_NAME)\r\n  If idFolder = &quot;NoFolder&quot; Then idFolder = CreateSkyDriveFolder(AccessToken, FOLDER_NAME)\r\n  If (idFolder = &quot;Err&quot;) Or Len(idFolder) &lt; 1 Then\r\n    MsgBox &quot;SkyDrive\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u78ba\u8a8d\u30fb\u4f5c\u6210\u51e6\u7406\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;, 16 + 4096\r\n    Exit Sub\r\n  End If\r\n  dat = GetStream(filePath)\r\n  fileName = CreateObject(&quot;Scripting.FileSystemObject&quot;).GetFileName(filePath) '\u30d5\u30a1\u30a4\u30eb\u540d\u53d6\u5f97\r\n  With CreateObject(&quot;MSXML2.XMLHTTP&quot;)\r\n    .Open &quot;PUT&quot;, &quot;https:\/\/apis.live.net\/v5.0\/&quot; &amp; idFolder &amp; &quot;\/files\/&quot; &amp; EncodeURL(fileName) &amp; &quot;?overwrite=true&quot;, False\r\n    .setRequestHeader &quot;Authorization&quot;, &quot;Bearer &quot; &amp; AccessToken\r\n    .send dat\r\n    Select Case .Status\r\n      Case 200, 201:\r\n      Case Else\r\n        MsgBox &quot;\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u51e6\u7406\u304c\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;, 16 + 4096\r\n        Exit Sub\r\n    End Select\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Sub AuthenticateSkyDrive()\r\n'SkyDrive\u8a8d\u8a3c\r\n  Dim url\r\n  Dim scope\r\n  Dim timeLimit\r\n  \r\n  Set IE = Nothing '\u521d\u671f\u5316\r\n  scope = &quot;wl.skydrive_update wl.offline_access&quot;\r\n  url = &quot;http:\/\/oauth.live.com\/authorize?locale=ja&amp;display=page&amp;client_id=&quot; &amp; EncodeURL(CLIENT_ID) &amp; &quot;&amp;scope=&quot; &amp; EncodeURL(scope) &amp; &quot;&amp;response_type=token&amp;redirect_uri=&quot; &amp; EncodeURL(REDIRECT_URL)\r\n  Set IE = WScript.CreateObject(&quot;InternetExplorer.Application&quot;, &quot;IE_&quot;)\r\n  On Error Resume Next\r\n  With IE\r\n    .Visible = True\r\n    .Toolbar = False\r\n    .AddressBar = False\r\n    .MenuBar = False\r\n    .Top = 50\r\n    .Left = 200\r\n    .Width = 400\r\n    .Height = 500\r\n    .Navigate url\r\n    'While .Busy Or .readyState &lt;&gt; 4\r\n    '  WScript.Sleep 100\r\n    'Wend\r\n    timeLimit = DateAdd(&quot;s&quot;, 60, Now()) '\u30eb\u30fc\u30d7\u306e\u5236\u9650\u6642\u9593:60\u79d2\r\n    Do\r\n      WScript.Sleep 100\r\n      If FlgIeQuit = 1 Then Exit Do\r\n      If Now() &gt; timeLimit Then Exit Do '\u5236\u9650\u6642\u9593\u3092\u904e\u304e\u305f\u3089\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\r\n    Loop While ParamGet = &quot;&quot;\r\n    If FlgIeQuit = 0 Then .Quit\r\n  End With\r\n  If Err.Number &lt;&gt; 0 Then\r\n    MsgBox &quot;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002&quot; &amp; vbCrLf &amp; &quot;\u5185\u5bb9:&quot; &amp; Err.Description, 16 + 4096\r\n    Exit Sub\r\n  End If\r\n  On Error GoTo 0\r\n  If ParamGet = &quot;&quot; Then\r\n    MsgBox &quot;\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot;, 16 + 4096\r\n    Exit Sub\r\n  End If\r\n  GetToken ParamGet\r\nEnd Sub\r\n\r\nPrivate Sub GetToken(ByVal param)\r\n'\u5404\u30c8\u30fc\u30af\u30f3\u53d6\u5f97\r\n  Dim v, vv\r\n  Dim i\r\n  \r\n  param = Replace(param, REDIRECT_URL &amp; &quot;#&quot;, &quot;&quot;)\r\n  v = Split(param, &quot;&amp;&quot;)\r\n  For i = LBound(v) To UBound(v)\r\n    vv = Split(v(i), &quot;=&quot;)\r\n    Select Case LCase(Trim(vv(0)))\r\n      Case &quot;access_token&quot;: AccessToken = vv(1)\r\n      Case &quot;expires_in&quot;: ExpiresIn = vv(1): DateExpires = DateAdd(&quot;s&quot;, CDbl(ExpiresIn), Now()) '\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u6709\u52b9\u6642\u9593\u8a2d\u5b9a\r\n      Case &quot;authentication_token&quot;: AuthenticationToken = vv(1)\r\n    End Select\r\n  Next\r\nEnd Sub\r\n\r\nPrivate Function GetSkyDriveFolderId(ByVal code, ByVal fn)\r\n'SkyDrive\u306e\u30d5\u30a9\u30eb\u30c0\u30fcID\u53d6\u5f97\r\n'\u30d5\u30a9\u30eb\u30c0\u30fc\u306a\u3057:NoFolder, \u30d5\u30a9\u30eb\u30c0\u30fc\u3042\u308a:id, \u30a8\u30e9\u30fc:Err\r\n  Dim ret\r\n  Dim js\r\n  Dim scr\r\n  Dim d\r\n  Dim elm\r\n    \r\n  js = &quot;&quot;: ret = &quot;NoFolder&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  With CreateObject(&quot;MSXML2.XMLHTTP&quot;)\r\n    .Open &quot;GET&quot;, &quot;https:\/\/apis.live.net\/v5.0\/me\/skydrive\/files&quot;, False\r\n    .setRequestHeader &quot;Authorization&quot;, &quot;Bearer &quot; &amp; code\r\n    .send\r\n    If .Status = 200 Then js = .responseText\r\n  End With\r\n  If Len(js) &gt; 0 Then\r\n    js = Replace(js, vbCr, &quot;&quot;)\r\n    js = Replace(js, vbLf, &quot;&quot;)\r\n    js = Replace(js, vbCrLf, &quot;&quot;)\r\n    js = &quot;(&quot; &amp; js &amp; &quot;)&quot;\r\n    Set d = CreateObject(&quot;htmlfile&quot;)\r\n    Set elm = d.createElement(&quot;span&quot;)\r\n    elm.setAttribute &quot;id&quot;, &quot;result&quot;\r\n    d.body.appendChild elm\r\n    scr = &quot;var objects= eval('&quot; &amp; js &amp; &quot;').data;&quot;\r\n    scr = scr &amp; &quot;for(var i in objects){&quot;\r\n    scr = scr &amp; &quot;  if(objects&#x5B;i].type=='folder' &amp;&amp; objects&#x5B;i].name=='&quot; &amp; fn &amp; &quot;'){&quot;\r\n    scr = scr &amp; &quot;    document.getElementById('result').innerText=objects&#x5B;i].id;&quot;\r\n    scr = scr &amp; &quot;  }&quot;\r\n    scr = scr &amp; &quot;}&quot;\r\n    d.parentWindow.execScript scr\r\n    If Len(elm.innerText) &gt; 0 Then ret = elm.innerText\r\n  End If\r\n  If Err.Number &lt;&gt; 0 Then Err.Clear: ret = &quot;Err&quot;\r\n  On Error GoTo 0\r\n  GetSkyDriveFolderId = ret\r\nEnd Function\r\n\r\nPrivate Function CreateSkyDriveFolder(ByVal code, ByVal fn)\r\n'SkyDrive\u306b\u30d5\u30a9\u30eb\u30c0\u30fc\u4f5c\u6210\r\n  Dim js\r\n  Dim ret\r\n  Dim d\r\n  Dim elm\r\n  \r\n  js = &quot;&quot;: ret = &quot;&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  With CreateObject(&quot;MSXML2.XMLHTTP&quot;)\r\n    .Open &quot;POST&quot;, &quot;https:\/\/apis.live.net\/v5.0\/me\/skydrive\/&quot;, False\r\n    .setRequestHeader &quot;Authorization&quot;, &quot;Bearer &quot; &amp; code\r\n    .setRequestHeader &quot;Content-Type&quot;, &quot;application\/json&quot;\r\n    .send &quot;{&quot;&quot;name&quot;&quot;: &quot;&quot;&quot; &amp; fn &amp; &quot;&quot;&quot;}&quot;\r\n    If .Status = 201 Then js = .responseText\r\n  End With\r\n  If Len(js) &gt; 0 Then\r\n    js = Replace(js, vbCr, &quot;&quot;)\r\n    js = Replace(js, vbLf, &quot;&quot;)\r\n    js = Replace(js, vbCrLf, &quot;&quot;)\r\n    js = &quot;(&quot; &amp; js &amp; &quot;)&quot;\r\n    Set d = CreateObject(&quot;htmlfile&quot;)\r\n    Set elm = d.createElement(&quot;span&quot;)\r\n    elm.setAttribute &quot;id&quot;, &quot;result&quot;\r\n    d.body.appendChild elm\r\n    d.parentWindow.execScript &quot;document.getElementById('result').innerText=eval('&quot; &amp; js &amp; &quot;').id;&quot;\r\n    ret = elm.innerText\r\n  End If\r\n  If Err.Number &lt;&gt; 0 Then Err.Clear: ret = &quot;Err&quot;\r\n  On Error GoTo 0\r\n  CreateSkyDriveFolder = ret\r\nEnd Function\r\n\r\nPrivate Function GetStream(ByVal filePath)\r\n  Dim ret\r\n  Const adTypeBinary = 1\r\n  \r\n  With CreateObject(&quot;ADODB.Stream&quot;)\r\n    .type = adTypeBinary\r\n    .Open\r\n    .LoadFromFile filePath\r\n    ret = .Read(-1)\r\n    .Close\r\n  End With\r\n  GetStream = ret\r\nEnd Function\r\n\r\nPrivate Function EncodeURL(ByVal sWord)\r\n  Dim d\r\n  Dim elm\r\n  \r\n  sWord = Replace(sWord, &quot;\\&quot;, &quot;\\\\&quot;)\r\n  sWord = Replace(sWord, &quot;'&quot;, &quot;\\'&quot;)\r\n  Set d = CreateObject(&quot;htmlfile&quot;)\r\n  Set elm = d.createElement(&quot;span&quot;)\r\n  elm.setAttribute &quot;id&quot;, &quot;result&quot;\r\n  d.body.appendChild elm\r\n  d.parentWindow.execScript &quot;document.getElementById('result').innerText=encodeURIComponent('&quot; &amp; sWord &amp; &quot;');&quot;\r\n  EncodeURL = elm.innerText\r\nEnd Function\r\n\r\nPublic Sub IE_DocumentComplete(ByVal pDisp, url)\r\n  If InStr(url, REDIRECT_URL &amp; &quot;#access_token=&quot;) Then ParamGet = url\r\nEnd Sub\r\n\r\nPublic Sub IE_OnQuit()\r\n  FlgIeQuit = 1\r\nEnd Sub<\/pre>\n<p>JSON\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u300164\u30d3\u30c3\u30c8\u74b0\u5883\u3067\u306fScriptControl\u304c\u4f7f\u3048\u306a\u3044\u306e\u3067\u4ee3\u308f\u308a\u306bHTMLDocument\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u534a\u3070\u7121\u7406\u3084\u308a\u51e6\u7406\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3082\u3042\u308b\u306e\u3067\u3001\u5168\u4f53\u7684\u306b\u4f55\u3060\u304b\u6ce5\u81ed\u3044\u51e6\u7406\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u30fb\u30fb\u30fb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"2012\/12\/19 \u8ffd\u8a18\uff1a \u30fb\u95a2\u9023\u8a18\u4e8b\u300cSkyDrive\u4e0a\u306e\u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308bVBScript\u300d\u3082\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002 Microsoft\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u7121\u6599\u306e\u30aa\u30f3\u30e9\u30a4\u30f3\u30b9\u30c8\u30ec\u30fc\u30b8\u300cSkyDrive\u300d\u306f [&hellip;]","protected":false},"author":1,"featured_media":7132,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[97],"class_list":["post-2489","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vbs","tag-skydrive-api"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-VBScript.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-E9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2489"}],"version-history":[{"count":11,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2489\/revisions"}],"predecessor-version":[{"id":14215,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2489\/revisions\/14215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7132"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}