Office 365 REST API - Outlook User Photo - c#

I'm attempting to retrieve other users' outlook photos using the Office 365 REST API (Preview). The documentation is here on this page: https://msdn.microsoft.com/en-us/office/office365/api/photo-rest-operations.
I'm able to successfully retrieve my own photo using an access token by making the following rest call:
GET https://outlook.office365.com/api/beta/me/userphoto/$value
However, when attempting to retrieve the photos of other people in my organization by using this REST call:
GET https://outlook.office365.com/api/beta/Users('{user_id}')/userphotos('{size}')/$value
I get the following error:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again."
}
}
This error isn't listed anywhere in the documentation as far as I can tell. I suspect this has something to do with the permissions in Azure but that's only a guess. Maybe it isn't supported in the preview API? Anyone have any ideas?

nkorai, you are right, the current permission set does not allow you to see others photo. We are adding a new oauth permission to the exchange online application endpoint which will allow you to do this. We are in the process of getting this permission enabled. Hopefully in a few weeks.

Related

Get notification when user updated on Azure AD using MS Graph

I am trying to get notification when user is updated on MS Azure AD using MS Graph and Web hook.I have tried microsoftgraph/msgraph-training-changenotifications but face following
Status Code: Unauthorized
Microsoft.Graph.ServiceException: Code: ExtensionError
Message: Operation: Create; Exception: [Status Code: Unauthorized; Reason: ]
I have also explore notifications for changes in user data this code but it is for "Mail.Read" permission and I want to "User.Read" permission .
My case/issue is like Not receiving a request on our MS Graph Webbook for deleting a User in AAD but something different. i need notification on update user on my asp.net core project.
Please help me. I am troubling since last 3 days but not getting proper solution
I was missing to give a permission in Azure AD
User.ReadWrite.All
I have watched this video Change notifications with Microsoft Graph and use this code msgraph-training-changenotifications .Now i got notification from Azure AD

.Net Microsoft team Meeting API generating access denied token

I have tried to create a Microsoft team API to create an online meeting. I have created an app register in azure with clientId and tenantId. I added permission with the delegate, and in other times in public as a trial as I know delegate is the correct and then create secret, and I tested it in Microsoft explorer it works perfectly now I tried to work with it in c# code I got token. However, I noticed that the token is different from Microsoft explorer, so I got an error in creating event access denied as the token does not have permission.
The second question can I generate a unique link for the meeting for each attendance.
The error I'm receiving is
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"date": "2020-12-03T13:05:33",
"request-id": "cc2dbedc-610e-4d95-a30d-672ff241efa4",
"client-request-id": "cc2dbedc-610e-4d95-a30d-672ff241efa4"
}
}
}
This is happening because Security Defaults is enabled for your tenant.
For each request made to the API, the token changes so the token received in graph explorer will be different from the token received via Code.
Check and try with Auth Request for token and pass the token received to the online meeting API

sharepoint 2016 access denied issue

First of all, I am trying to retrieve decent webinfo of my web application however I received Access denied error and the error is coming from site collection “sitemaster-a118466c-660d-479c-873f-af6284910724” as screen shot below
I never create “sitemaster-a118466c-660d-479c-873f-af6284910724” as my site collection, so I suspect it is bundle with “Publishing” template.
Below is the sample code that I use to retrieve my decent webinfo, and I have my access denied error here.
SPSecurity.RunWithElevatedPrivileges(delegate ()
{
using (SPSite site = new SPSite(SiteCollectionUrl))
{
//code to retrieve my web application decent info
}
}
Once I face this I wanted to update ““sitemaster-a118466c-660d-479c-873f-af6284910724” site collection administrator users however I cannot find it from sharepoint centraladmin site.

How can I use publish_actions for testing without review?

I need to test score's post to facebook but it requires publish_actions permission. I use the last version of Facebook SDK for Unity3D. Is it possible to get publish_actions permission without review of my application? I tried to get this permission using
FB.Login( "publish_actions", LoginCallback );
But FBResult of LoginCallback always returns error (403 forbidden) when I try to post score. I also tried to use test users of facebook sdk to test it but with no luck (the same problem - 403 forbidden). I read here that I as admin can use all permissions without review. But how?
These are the steps you need to do to get more permisions for your development access token:
Go to the following URL: 'https://developers.facebook.com/tools/explorer/'
From the dropdown near the top, select the application you want to get extended permissions for
Click on 'Get Acces Token'
Select all the permisions you want (including publish_actions)
Copy the access token generated in the text field besides it, and use it inside Unity when it prompts you for an access token.
Hope this sorts it out for you. If any step is not clear, let me know

Twitter API + OAuth: Can't send status updates, getting 401

I'm trying to use Twitter's API and OAuth to send status updates (new Tweets). I am using Shannon Whitley .NET code example http://www.voiceoftech.com/swhitley/?p=681 (as recommended on the Twitter API docs). I can read (GET) using OAuth just fine, however when I try to send a status update via http ://twitter.com/statuses/update.xml (using a POST), it returns a 401 with the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<request>/statuses/update.xml</request>
<error>Read-only application cannot POST</error>
</hash>
I swear I have set up my application to use read and write, the authorise page at Twitter (http ://twitter.com/oauth/authorize) even says "The application TweeVerbs.com (Development) by would like the ability to access and update your data on Twitter."
Yet it's still saying "Read-only application cannot POST". WTF!?
I have googled this error message until I was blue in the face. I found somewhere that said to add the querystring paremeter oauth_access_type=write to the redirect URL which goes to the Twitter authorise page which I have done, but it still gives me a 401.
If it helps, here is the data that is getting sent back and firth as per the OAuth workflow:
Request Authorise Token:
http ://twitter.com/oauth/request_token?oauth_consumer_key=tViV8vAt4cqSKbGdPGWT7Q&oauth_nonce=2790042&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1244567068&oauth_version=1.0&oauth_signature=KzxcXN%2bQ0AJoAJ%2flQfzs8SLjC%2fQ%3d
Generated Authorize Redirect URL:
http ://twitter.com/oauth/authorize?oauth_token=EpyBg3nJGOmtmBjRUAsqqaGHARb2F2F2VcccqHkwio&oauth_access_type=write
Authorise Screen Message: "The application TweeVerbs.com (Development) by would like the ability to access and update your data on Twitter. This application plans to use Twitter for logging you in in the future. Sign out if you want to connect to an account other than Sironfoot."
Get Access Token:
http ://twitter.com/oauth/access_token?oauth_consumer_key=tViV8vAt4cqSKbGdPGWT7Q&oauth_nonce=2016804&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1244567166&oauth_token=EpyBg3nJGOmtmBjRUAsqqaGHARb2F2F2VcccqHkwio&oauth_version=1.0&oauth_signature=%2bEVQUxUPLT%2b%2bkfaG0Vq1YJZXcAw%3d
Status Update API call:
URL - http ://twitter.com/statuses/update.xml
POST data - oauth_consumer_key=tViV8vAt4cqSKbGdPGWT7Q&oauth_nonce=5707692&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1244567268&oauth_token=19130957-nb89DjZhjCAzcbHUa96yRWHqlQFQIJ0AKyXpqnHt1&oauth_version=1.0&status=HelloWorld&oauth_signature=WqA%2bWY0IxveeSJ7G3Ewy3whh1sE%3d
I don't know what the problem was, but I deleted my Application registration on Twitter (You have to register apps in Twitter to get OAuth keys etc.), and then recreated it. Now it works fine. Weird, probably a problem with Twitter screwing up.
I'm also using Tweetsharp (http://tweetsharp.com/), highly recommend it, it's got a nice fluent API. Note: switching over to Tweetsharp wasn't the fix, I had already switched over and had the same problem until I delete and recreated app registration on Twitter.
If you authorized your application to access your Twitter account when the application was set in "read only access" mode and you get the "Read-only application cannot POST" error after changing the application settings to be "read and write access" then you have to revoke access to the application on https://twitter.com/settings/connections and then reauthorize it. The "read only" access_token tends to be sticky until you revoke it.
Go to http://www.twitter.com/oauth_clients
Select your App.
Edit Application Setting.
Set Default Access type to Read & Write.
Save & Run.
Hope this helps.
plus also see if your system's CLOCK is synched with internet; on windows you can do it by adjusting date time settings
because if you CLOCK is not synched you will get 401 unauthorized exception; best of luck
cheers
I've dont that several times now, without succes, I'm getting a 401 exception while requesting an acces token from twitter.
I'm using Tweetsharp as well as you.

Categories