Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fabianwilliams-zz/ca961ae513ac22f9f6c58ad7208b96b0 to your computer and use it in GitHub Desktop.
Save fabianwilliams-zz/ca961ae513ac22f9f6c58ad7208b96b0 to your computer and use it in GitHub Desktop.
Graph Connector: Create Connection, Schema, and Index for our Demo
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 1,
"items": [
{
"type": "Image",
"url": "{image}",
"size": "Large",
"horizontalAlignment": "Left"
}
],
"spacing": "None"
},
{
"type": "Column",
"width": 9,
"items": [
{
"type": "TextBlock",
"text": "[{productname}]({producturl})",
"color": "Accent",
"size": "Medium",
"weight": "Bolder",
"maxLines": 3
},
{
"type": "TextBlock",
"text": "{Description}",
"wrap": true,
"maxLines": 3,
"spacing": "Medium"
}
],
"horizontalAlignment": "Center",
"spacing": "Medium"
}
],
"spacing": "None"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"$data": {
"description": "Marketing team at Contoso.., and looking at the Contoso Marketing documents on the team site. This contains the data from FY20 and will taken over to FY21...Marketing Planning is ongoing for FY20..",
"image": "https://searchuxcdn.blob.core.windows.net/designerapp/images/long-stock-image.png",
"producturl": "https://modernacdesigner.azurewebsites.net",
"productname": "Contoso Research Memo"
}
}
{
"name": "FabsDemoFilesDriveAlpha",
"description": "Index my hard drive network share demo",
"id": "fabsdemofilesdrivealpha"
}
{
"baseType": "microsoft.graph.externalItem",
"properties": [
{
"name": "uniqid",
"type": "String",
"isSearchable": "false",
"isRetrievable": "false",
"isQueryable": "false"
},
{
"name": "producturl",
"type": "String",
"isSearchable": "false",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "productname",
"type": "String",
"isSearchable": "true",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "retailprice",
"type": "String",
"isSearchable": "false",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "discountedprice",
"type": "String",
"isSearchable": "false",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "image",
"type": "String",
"isSearchable": "false",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "description",
"type": "String",
"isSearchable": "true",
"isRetrievable": "true",
"isQueryable": "false"
},
{
"name": "brand",
"type": "String",
"isSearchable": "false",
"isRetrievable": "true",
"isQueryable": "true"
}
]
}
{
"@odata.type": "microsoft.graph.externalItem",
"acl": [
{
"type": "user",
"value": "your-user-GUID-here-347aac675901",
"accessType": "grant",
"identitySource": "azureActiveDirectory"
}
],
"properties": {
"uniqid": "{{uniqid}}",
"producturl": "{{producturl}}",
"productname": "{{productname}}",
"retailprice": "{{retailprice}}",
"discountedprice": "{{discountedprice}}",
"image": "{{image}}",
"description": "{{description}}",
"brand": "{{brand}}"
},
"content": {
"value": "Error in gateway...",
"type": "text"
}
}
@fabianwilliams-zz
Copy link
Author

WHAT: This is a Gist for an end to end scenario demo and blog to create and consume a Microsoft Search Graph Connector
WHO: the user persona in the Index Json above represents a user in your active directory that you want to have access to this data
WHEN: you will be setting this up after you have created your App Registration in Azure AD. See order of operations below
WHERE: you will be doing this anywhere you can fire off an API, for simplicity sake you can do this in Postman but you can do this from your own published Web API service
WHY: because you are here to learn
HOW: see my blog post for details

Order of Operations

  1. createexternalconnection.json as a POST to https://graph.microsoft.com/beta/external/connections
  2. createexternaldataschema.json as a POST to https://graph.microsoft.com/beta/external/connections/fabsdemofilesdrivealpha/schema
  3. createindexforschema.json as a PUT to https://graph.microsoft.com/beta/external/connections/fabsdemofilesdrivealpha/items/{{uniqid}}
  4. createadaptivecardforresulttype is used in the Search Admin Center after your create your Search Vertical

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment