vba - 我可以使用带有 VBA 的 goole 日历 API(从 MS-Excel 创建日历条目)
问题描述
我喜欢从 Microsoft Excel 2016 创建一个新的谷歌日历条目,我该怎么做?
我尝试了以下代码,但在“xmlhttp.send ...”处出现超时。
Sub AddGoogleKalenderEntry()
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", "https://www.google.com/accounts/ClientLogin", False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send "accountType=HOSTED_OR_GOOGLE&Email=<User>@gmail.com&Passwd=<PWD>" & "&source=Gulp-CalGulp-1.05&service=cl"
Lines = Split(xmlhttp.responseText, vbLf)
nvp = Split(Lines(2), "=")
Set xmlhttp = Nothing
calentry = "<?xml version='1.0' ?><entry xmlns='http://www.w3.org/2005/Atom' " _
& "xmlns:gd='http://schemas.google.com/g/2005'>" _
& "<category scheme='http://schemas.google.com/g/2005#kind' " _
& "term='http://schemas.google.com/g/2005#event'></category>" _
& "<title type='text'>Tennis with Beth</title>" _
& "<content type='text'>Meet for a quick lesson.</content>" _
& "<gd:transparency " _
& "value='http://schemas.google.com/g/2005#event.opaque'>" _
& "</gd:transparency>" _
& "<gd:eventStatus " _
& "value='http://schemas.google.com/g/2005#event.confirmed'>" _
& "</gd:eventStatus>" _
& "<gd:where valueString='Rolling Lawn Courts'></gd:where>" _
& "<gd:when startTime='2010-01-22T15:00:00.000Z' " _
& "endTime='2010-01-22T17:00:00.000Z'></gd:when>" _
& "</entry>"
url = "http://www.google.com/calendar/feeds/default/private/full"
Call postEntry(url, nvp)
End Sub
解决方案
推荐阅读
- regex - 你如何在 Haskell 中陈述正则表达式模式?
- ruby - Stripe::AuthenticationError -Ruby on Rails
- android - 颤振没有找到动作栏
- python - [源于一个简单的错字的胡说八道]
- java - 阻止 Android Studio 隐藏/缩短代码?
- python - 无法将元组插入列表
- css - Bootstrap - 左侧菜单可能存在 CSS 问题
- amazon-eks - 如何使用 kubectl 从 Cloud 9 实例连接到 EKS 集群
- javascript - 使用单个 jquery 脚本在一个页面中播放多个视频
- django - 我想将一个模型的 id 存储到另一个模型中-Django using Views