-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #781 from kasperbolarsen/main
sample exporting data from MS Search externalItems
- Loading branch information
Showing
8 changed files
with
126 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
plugin: add-to-gallery | ||
--- | ||
|
||
# Export data from MS Search | ||
|
||
|
||
## Summary | ||
|
||
When working with data imported into the Microsoft Search service using Graph Connectors, it can be useful to export the data to a format of your choice for further analysis or to import it into another system. | ||
|
||
![Example Screenshot](assets/example.png) | ||
|
||
You will have to connect just as usual, then you must specify the entity type you want , the fields (if you don't know the names of the fields, you can look in the Search And Intelligence Admin Center) or export the schema using Get-PnPSearchExternalSchema | ||
Finally you have to provide the name of the external data source (you can get this from the Search And Intelligence Admin Center) | ||
|
||
|
||
# [PnP PowerShell](#tab/pnpps) | ||
|
||
```powershell | ||
$clientId = "aaaaaa-11111-222222-bbbbb-44444444" | ||
$portalConn = Connect-PnPOnline -Url "https://contoso.sharepoint.com" -Interactive -ClientId $clientId -ReturnConnection | ||
$content = @{ | ||
"Requests" = @( | ||
@{ | ||
"entityTypes" = @( | ||
"externalItem" | ||
) | ||
"query" = @{ | ||
"queryString" = "*" | ||
} | ||
"contentSources" = @( | ||
"/external/connections/AzureSqlConnector3" | ||
) | ||
"fields"= @( | ||
"CustomerName", | ||
"CustomerArea", | ||
"LocationID", | ||
"LocationName", | ||
"Responsible" | ||
) | ||
} | ||
) | ||
} | ||
#converting the content to json in order to use it in the Graph Explorer, which is a great way to test the queries | ||
$json = $content | ConvertTo-Json -Depth 10 | ||
$res = Invoke-PnPGraphMethod -Url "/v1.0/search/query" -Method Post -Content $content -Connection $portalConn | ||
$hits = $res.value.hitsContainers.hits | ||
foreach($hit in $hits) | ||
{ | ||
$hit.resource.properties | ||
#do something with the data, like exporting it to a csv file | ||
} | ||
``` | ||
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)] | ||
*** | ||
|
||
|
||
## Contributors | ||
|
||
| Author(s) | | ||
|-----------| | ||
| Kasper Larsen | | ||
|
||
[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)] | ||
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/export-data-from-microsoft-search" aria-hidden="true" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions
54
scripts/export-data-from-microsoft-search/assets/sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[ | ||
{ | ||
"name": "export-data-from-microsoft-search", | ||
"source": "pnp", | ||
"title": "Export data from MS Search", | ||
"shortDescription": "Shows how to export data from MS Search, in this case the entityType externalItem ", | ||
"url": "https://pnp.github.io/script-samples/export-data-from-microsoft-search/README.html", | ||
"longDescription": [ | ||
"" | ||
], | ||
"creationDateTime": "2024-11-11", | ||
"updateDateTime": "2024-11-11", | ||
"products": [ | ||
"Graph", | ||
"Microsoft Search" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "PNP-POWERSHELL", | ||
"value": "2.12.0" | ||
} | ||
], | ||
"categories": [ | ||
"Data", | ||
"Report" | ||
], | ||
"tags": [ | ||
"Invoke-PnPGraphMethod" | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/export-data-from-microsoft-search/assets/preview.png", | ||
"alt": "Preview of the sample Export data from MS Search" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "kasperbolarsen", | ||
"company": "", | ||
"pictureUrl": "https://github.com/kasperbolarsen.png", | ||
"name": "Kasper Larsen" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Want to learn more about PnP PowerShell and the cmdlets", | ||
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.", | ||
"url": "https://aka.ms/pnp/powershell" | ||
} | ||
] | ||
} | ||
] |
177 changes: 0 additions & 177 deletions
177
scripts/spo-apply-custom-form-formatting-json/README.md
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
55 changes: 0 additions & 55 deletions
55
scripts/spo-apply-custom-form-formatting-json/assets/sample.json
This file was deleted.
Oops, something went wrong.