Sam's Microsoft Dynamics 365 Blog

Wednesday, 17 March 2021

Graph APIs Calling option in "HTTP Request" connector in Power Automate

Graph APIs Calling option in "HTTP Request" connector in Power Automate. I have followed some below steps for calling Graph API:

a. Registered an App in Azure Active Directory and got Tenant ID, Client ID, Client Secret.



b. Created a Power Automate Flow and added HTTP request as an Action. In Authentication option inside HTTP action, selected Active Directory OAuth and added value for Tenant, Client ID, Secret etc.




Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Thursday, 27 February 2020

Using of Azure Active Directory Graph API

In this article, we will discuss about How to use Azure Active Directory Graph API.

Note:- Before starting using we have to register a new app in Azure Active Directory and then need to assign Permissions, after that we are able to get Client ID, Client Secret, Object ID

Prerequisite:

i. Client ID
ii. Client Secret
iii. Object ID
iv. Azure Account User details (Username and Password)

So, let's discuss step by step:

Login to Azure AD: -


{
"name": "Login",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "client_id",
"value": "036d42bc-2b3f-41da-a302-29d09eac37eb",
"type": "text"
},
{
"key": "client_secret",
"value": "k=dZOh.RZL[0334j:A=Tx.K5bVMEx:.G",
"type": "text"
},
{
"key": "username",
"value": "sam@saddamk206.onmicrosoft.com",
"type": "text"
},
{
"key": "password",
"value": "Pak11929",
"type": "text"
},
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "resource",
"value": "https://graph.microsoft.com",
"type": "text"
},
{
"key": "scope",
"value": "openid",
"type": "text"
}
]
},
"url": {
"raw": "https://login.microsoftonline.com/78a74a06-7d8f-4205-95ca-836e6937e795/oauth2/token?",
"protocol": "https",
"host": [
"login",
"microsoftonline",
"com"
],
"path": [
"78a74a06-7d8f-4205-95ca-836e6937e795",
"oauth2",
"token"
],
"query": [
{
"key": "",
"value": null
}
]
}
},
"response": []
}



New User Registration:


{
"name": "create",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "\r\n{\r\n  \"accountEnabled\": true,\r\n  \"displayName\": \"sam khan\",\r\n  \"mailNickname\": \"sam\",\r\n  \"userPrincipalName\": \"samk1@saddamk206.on microsoft.com\",\r\n  \"passwordProfile\" : {\r\n    \"forceChangePasswordNextSignIn\": true,\r\n    \"password\": \"Pass@word1\"\r\n  }\r\n}\r\n\r\n\r\n"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users"
]
}
},
"response": []
}


Edit User Details:


{
"name": "Edit User",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "\r\n{\r\n \"givenName\": \"sam\",\r\n    \"jobTitle\": \"Dynamics Architect\",\r\n     \"mobilePhone\": \"9988776600\",\r\n    \"officeLocation\": \"India\",\r\n    \"preferredLanguage\": \"en-us\",\r\n    \"surname\": \"Khan\"\r\n}\r\n\r\n\r\n"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/57e64c5f-cf09-4b85-be69-a589057d4a34",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"57e64c5f-cf09-4b85-be69-a589057d4a34"
]
}
},
"response": []
}


Update Password:

{
"name": "Update password",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "PATCH",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": " {\r\n   \"passwordProfile\": {\r\n                \"forceChangePasswordNextSignIn\": false,\r\n                \"password\": \"mQht3Wthnj2\"\r\n            }\r\n    }"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/57e64c5f-cf09-4b85-be69-a589057d4a34",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"57e64c5f-cf09-4b85-be69-a589057d4a34"
]
}
},
"response": []
}


Get License:


{
"name": "Get license",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/a4cb01c0-f5d2-4787-8cbf-9726cdd8466c/subscribedSkus",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"a4cb01c0-f5d2-4787-8cbf-9726cdd8466c",
"subscribedSkus"
]
}
},
"response": []
}


Assign License:


{
"name": "assign license",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-type",
"value": "application/json",
"type": "text"
},
{
"warning": "This is a duplicate header and will be overridden by the Authorization header generated by Postman.",
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n  \"addLicenses\": [\r\n    {\r\n      \"disabledPlans\": [ ],\r\n      \"skuId\": \"4b9405b0-7788-4568-add1-99614e613b69\"\r\n    }\r\n  ],\r\n  \"removeLicenses\": [ ]\r\n}"
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/a4cb01c0-f5d2-4787-8cbf-9726cdd8466c/assignLicense",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"a4cb01c0-f5d2-4787-8cbf-9726cdd8466c",
"assignLicense"
]
}
},
"response": []
}


Enable-Disable User Account:


{
"name": "Enable-Disable User Account",
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Authorization",
"value": "Bearer <Token>",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n    \"accountEnabled\": true\r\n}",
"options": {
"raw": {
"language": "javascript"
}
}
},
"url": {
"raw": "https://graph.microsoft.com/v1.0/users/655f60c8-66db-4c7c-a87b-76680e7f89a7",
"protocol": "https",
"host": [
"graph",
"microsoft",
"com"
],
"path": [
"v1.0",
"users",
"655f60c8-66db-4c7c-a87b-76680e7f89a7"
]
}
},
"response": []
}




Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Wednesday, 26 February 2020

Add a Calculated Date on a Date Field with Workflow

In this article, we will discuss about How to add a Calculated Date on a Date Field with Workflow.

Here I am going to create a new workflow that will trigger on email activity record creation. And it will create a Task with Actual Start Date and Actual End Date. In Actual Start date I will put Current record creation date and in Actual End Date I will put 1-month later date.

So, let's discuss step by step:

1. Create a new workflow e.g. I have created on Email new record creation.

2. Add a step e.g. I have created a new Task in step.




3. Select a Date field e.g. I have selected a field “Actual End”.

4. I want to add 1-month later date, so I am Selecting below Values in Form Assist

   • “Month as 1”
   • “After”
   • “Email” and “Created On”
                       


                        
5. Then click on Add.




6. I am also putting Created on Value inside “Actual Start”.

7. Save and Activate the Workflow.

Now i am going to create an Email record.

After create an Email record, workflow has created a new Task and it is working fine with date values.


Thanks for reading the article. Hope this Article will helpful for you. Cheers!!!

Graph APIs Calling option in "HTTP Request" connector in Power Automate

Graph APIs Calling option in "HTTP Request" connector in Power Automate. I have followed some below steps for calling Graph API: a...