0
因爲我有工作的OAuth和可以得到的PowerShell原生谷歌CAL條目是這樣的:谷歌日曆插頁的PowerShell
$from=$((Get-Date).adddays(-1)).ToString("yyyy-MM-ddTHH:mm:ss-ff:ff")
$to=$((Get-Date).adddays(+7)).ToString("yyyy-MM-ddTHH:mm:ss-ff:ff")
$Events = Invoke-RestMethod -Uri `
"https://www.googleapis.com/calendar/v3/calendars/$calid/events?access_token=$accesstoken&timeMin=$from&timeMax=$to"
我現在正在試圖找出如何做插入和真的不知道如何告訴API我想要做的插入:
$NewEvent = @{
summary="Google I/O 2015";
location="800 Howard St., San Francisco, CA 94103";
description="A chance to hear more about Google developer products.";
start = @{
date_time ="2017-10-09T09:00:00-07:00";
time_zone =" ''America/Los_Angeles''";
}
}
$ReturnI = Invoke-RestMethod -Uri `
"https://www.googleapis.com/calendar/v3/calendars/$calid/events?access_token=$accesstoken&Method=insert" -Method Get -body $NewEvent
我的問題是因此一)有我犯了一個有效的$ NewEvent和b)我怎麼做一個Invoke-RestMethod到coraspond到谷歌的API方法?
感謝
你可能不得不改變方法發佈 –