Creating a Plan in Planner - json

I want to create a plan in Planner. The endpoint I call is:
https://graph.microsoft.com/beta/planner/plans
In return I get:
{
"error": {
"code": "",
"message": "You do not have the required permissions to access this item, or the item may not exist.",
"innerError": {
"request-id": "2654b7da-4ee4-47b8-83f8-e9514088c095",
"date": "2018-10-01T10:57:34"
}
}
}
My permissions and scopes are:
SCOPES = ['User.Read', 'Group.ReadWrite.All']
I gave Admin Consent for these permissions.
As a payload I send:
{
"title": "test",
"owner": "<myID>"
}
Where <myID> is the ID of the account requested per /me
Still it does not work - what did I miss?

The owner property should be a Group's id, not the User's id. Users can only have one individual "plan". Since this already exists, you cannot create a new one.
From the documentation:
In the request body, supply a JSON representation of plannerPlan object. The owner property must be set to an id of a group object.

Related

Unable to send message to end user (msteams) via Bot

Facing issue to send proactive message to the end user (msteams), via bot service,
I try using the bot framework python SDK, where I am getting the following error even for getting conversation id.
botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Unauthorized'
Hence I try to simulate calls via postman and rest API's, in here I am able to get conversation id successfully, but if I try to use that conversation id to further send a message via activities I am not able to do it. following is rest endpoint and payload. In here I am getting an error of incorrect payload.
https://smba.trafficmanager.net/apis/v3/conversations/8:orgid:949a3f72-b82c-4b89-b2de-9defbe6ae7cd/activities
{
"type": "message",
"recipient": {
"id": "29:1ZcsKdk0rsLmsywvI2SNQ2J7OIz"
},
"from": "bot",
"channelData": {
"notification": {
"alert": "true"
}
},
"text": "Hello world"
}
There was an issue with payload, I added BOT_ID along with name and able to successfully post message to end user. Following is working payload.
Payload:
{ "type":"message",
"recipient":{
"id":"29:1dUxQXVlH6QGByu1T9MR4p5g0c5URMaBtKqGU74C3zdowO78nPbuu2dg- qj9o02OkJ4MYXt2I-nxDgf9ga9EY5w"
},
"from":{
"id":"28:d7afe8c9-f0cd-434f-8906-be2b744229ac",
"name":"bot"
},
"channelData":{
"notification":{
"alert":"true"
}
},
"text":"Hello "
}

Unable to list users of all group emails (google apps script)

I am trying to write a script that will save all users of a Group address to a spreadsheet. I am running into a problem with groups that I am not a member of. (this works fine if I am a member or owner of the group)
If i go to https://groups.google.com/a/(domain)/forum/#!members/(groupname) I can view all of the members of the group. However when I try to program this out using:
var group = GroupsApp.getGroupByEmail(GROUP_EMAIL);
var users = group.getUsers();
I get: "You do not have permission to view the member list for the group:" for groups that I am not currently a member/owner of. For the sake of not having to add me to every group, is there a way to get this to work with out needing access to the AdminDirectory?
When I tried with AdminDirectory, I get:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Not Authorized to access this resource/api"
}
],
"code": 403,
"message": "Not Authorized to access this resource/api"
}
}
I would think there would be since I can view all members from the http address that I listed above, even while not a member

Agument list files API call with createdTime attribute in Google Drive API

I'd like to retrieve all the resources (files and folder) via the Files: list
API call with the createdTime attribute included.
Standard response doesn't include the createdTime key described in the resource representation so I've added the fields query parameter with the value createdTime (there's an open issue related which says so but referring to API v2 while I'm using API v3).
API call I'm doing is the following:
https://www.googleapis.com/drive/v3/files?fields=createdTime
with proper authentication.
A 400 status code response is returned with the following body:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidParameter",
"message": "Invalid field selection createdTime",
"locationType": "parameter",
"location": "fields"
}
],
"code": 400,
"message": "Invalid field selection createdTime"
}
}
What's the correct way of using the fields query parameter?
If you want to see the full response you can do the following test here
https://www.googleapis.com/drive/v3/files?fields=*
If you just want the create date you can also do test here
https://www.googleapis.com/drive/v3/files?fields=files(createdTime)
You can read more about this in Partial response

Update user's properties (aboutMe, skills) with app permission

When I am trying to update the user's aboutMe property via /v1.0/users/[user-principal-name] I get following error message:
{
"error":
{
"code": "-1, Microsoft.Office.Server.Directory.DirectoryObjectUnauthorizedAccessException",
"message": "Attempted to perform an unauthorized operation.",
"innerError":
{
"request-id": "a0112fff-de9a-4917-b627-c4103a04a105",
"date": "2018-03-22T11:02:46"
}
}
}
What I have done far:
Added application permissions User.ReadWrite.All and Directory.ReadWrite.All to registered app under apps.dev.microsoft.com
Concent for app was granted by admin via https://login.microsoftonline.com/[tenant]/adminconsent?client_id=[client-id]&state=12345&redirect_uri=[redirect-uri]
I am able to update the user's profile image or a property like mobilePhone.
What am I doing wrong/is it not possible to update those attributes?

Malformed JSON response when GETting /me/memberOf (Microsoft Graph)

I'm trying to set up a sign-on process for an internal company web app using the Azure AD and Microsoft Graph. I want to manage security groups in the AD, so when a user signs in via OAuth, I'm doing a GET request to https://graph.microsoft.com/v1.0/me/memberOf to see which groups the signed-in user is in. The user has the appropriate scopes to see this information, and it works in the Graph Explorer, but when I make the call in my PHP application, I get a malformed JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [{
"#odata.type": "#microsoft.graph.group",
"objectType": "Group",
"objectId": "blahblah2",
"deletionTimestamp": null,
"description": "Users who have access to my web app's administration",
"dirSyncEnabled": null,
"displayName": "Web App Administrators",
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "blahblah2",
"mailEnabled": false,
"onPremisesSecurityIdentifier": null {
"error": {
"code": "InternalServerError",
"message": "Unsupported extension property type.",
"innerError": {
"request-id": "blahblah3",
"date": "2016-02-29T09:42:18"
}
}
}
...and that's all I get!
The documentation at https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#GroupEntity says that this onPremisesSecurityIdentifier field is something to do with on-premesis sync, but i've never used that.
Your request had api-version query parameter appended (i.e. /v1.0/me/memberOf?api-version=1.6). Please remove that query parameter. Microsoft Graph identifies the API version by the first segment in the URL path, e.g. https://graph.microsoft.com/v1.0/me/memberOf or https://graph.microsoft.com/beta/me/memberOf