Beans before the user operation on the Office365 is typically done through a remote load module and then a session connection is created.
Like what
$cred = get-credential import-module msonlineset-executionpolicy remotesignedconnect-msolservice-credential $cred # Connect to Office365$session = New-pssession-configurationname Microsoft.exchange-connectionuri https:// outlook.office365.com/powershell/-credential $Cred-authentication basic-allowredirectionimport-pssession $session
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/70/wKioL1apfBDRR_zfAABHTAERAv4736.png "title=" 1.PNG " alt= "Wkiol1apfbdrr_zfaabhtaerav4736.png"/>
Then I can do some exchange PowerShell-related operations.
Like what
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/71/wKiom1apfteCXfVzAAAVjwJqiLc858.png "title=" 5.PNG " alt= "Wkiom1apftecxfvzaaavjwjqilc858.png"/>
It was discovered today that it can be operated directly via RESTAPI. After all, it is a Web page, the data are displayed on the Web page, then crawl the content directly from the network just fine.
The detailed rest API interface is shown below and can be accessed in the same way as hotmail,live, office365 and other Microsoft domain mail
Https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#EventResource
This link provides 1.0 and 2.0 interfaces, but 2.0 doesn't seem to work in Office 365, so I'm still using the 1.0 version.
Here are a few simple examples
For example, look at my personal information on my Office 365 account
$cred =get-credentialinvoke-restmethod-uri "https://outlook.office365.com/api/v1.0/me"-credential $cred
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7A/70/wKioL1apfViChe89AABPqukFw2w368.png "title=" 2.PNG " alt= "Wkiol1apfviche89aabpqukfw2w368.png"/>
View a calendar meeting appointment in the next 30 days
Invoke-restmethod-uri "https://outlook.office365.com/api/v1.0/me/calendarview?startdatetime=$ (Get-Date) & enddatetime=$ ((get-date). AddDays (()) "-credential $cred | foreach-object {$_.value} | Select subject, start, end, ShowAs
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7A/70/wKioL1apfkDCKBPlAABRBWQZXjs788.png "title=" 3.PNG " alt= "Wkiol1apfkdckbplaabrbwqzxjs788.png"/>
Check my e-mail
Invoke-restmethod-method Get-uri "Https://outlook.office365.com/api/v1.0/me/Folders/sentitems/messages"- Credential $cred | foreach-object {$_.value} | Select Subject,bodypreview
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7A/71/wKiom1apflOyKd8aAABFka0DbNo749.png "title=" 4.PNG " alt= "Wkiom1apfloykd8aaabfka0dbno749.png"/>
At present the restapi feeling is not very mature, also may be I did not find the correct interface. For example, he only supports the current user's query, if I want to query other people's records, will be an error. In the previous example, I was using the default get method to read, in theory it should also be possible to post to create mail, meeting invitations, etc., but my test is not too successful.
In general, however, Restapi is much quicker to use than loading a module and then writing a bunch of scripts, which is useful for quickly querying some online information.
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1739443
Powershell RESTAPI Access Office365