Skip to content

Instantly share code, notes, and snippets.

Patch('My Document Library Name', {
MyInternalLookupFieldName: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
// For illustrative purposes only - you would dynamically set this...
Value: "",
Id: -1
}
});
Patch('My Document Library Name', {
MyInternalLookupFieldName: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: MyLookupComboBox.Selected.Value,
// Notice the only additional property is the ID for lookups (otherwise it is the same as a choice value)
Id: MyLookupComboBox.Selected.ID
}
});
// You get the idea...
ForAll(
MyComboMultiSelectBox.SelectedItems,
Collect(
ChoiceValuesFromComboBox,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: Value
}
)
Patch('My Document Library Name', {
MyInternalChoiceFieldName: {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
// Where 'MyChoiceComboBox' is the single select combox box in your Power App
Value: MyChoiceComboBox.Selected.Value
}
});
// First of all we need to loop through each of the selected items in the combo box...
ForAll(
// Where 'MyComboMultiSelectBox' is your multi select combox box containing the selected items...
MyComboMultiSelectBox.SelectedItems,
Collect(
// Create a new collection called TaxonomyValuesFromComboBox
TaxonomyValuesFromComboBox,
{
// Create a new entry in the collection for each of the selected items...
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedTaxonomy",
@beckettkev
beckettkev / PowerApp.Patch.Single.MMD.js
Last active November 28, 2019 17:45
Setting a single valued taxonomy column from a combo box
// Where 'My Document Library Name' is the name of your document library / list
Patch('My Document Library Name', {
// Where 'MyInternalTaxonomyFieldName' is the internal name of the Managed Metadata column in SharePoint
MyInternalTaxonomyFieldName: {
// Where MyComboSelectBox is the single select combo box containing the selected choice in your Power App
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedTaxonomy",
TermGuid: MyComboSelectBox.Selected.TermGuid,
WssId: MyComboSelectBox.Selected.WssId,
Label: MyComboSelectBox.Selected.Label,
Path: MyComboSelectBox.Selected.Path,
{"viewXml": "<View Name=\"{ABEA11C2-AD01-33CD-AACD-1F5A587A0CBB}\" DefaultView=\"TRUE\" MobileView=\"TRUE\" MobileDefaultView=\"TRUE\" Type=\"HTML\" DisplayName=\"All Items\" Url=\"/sites/nameofsite/lists/Name of list/AllItems.aspx\" Level=\"1\" BaseViewID=\"1\" ContentTypeID=\"0x\" ImageUrl=\"/_layouts/15/images/generic.png?rev=47\"><Query><OrderBy><FieldRef Name=\"ID\" Ascending=\"FALSE\"/></OrderBy></Query><ViewFields><FieldRef Name=\"Title\"/><FieldRef Name=\"Created\"/><FieldRef Name=\"Modified\"/><FieldRef Name=\"MyCustomColumn1\"/><FieldRef Name=\"MyCustomColumn2\"/><FieldRef Name=\"MyCustomColumn3\"/><FieldRef Name=\"MyCustomColumn4\"/></ViewFields><RowLimit Paged=\"TRUE\">30</RowLimit><JSLink>clienttemplates.js</JSLink><XslLink Default=\"TRUE\">main.xsl</XslLink><Toolbar Type=\"Standard\"/><Aggregations Value=\"Off\"/></View>"}
@beckettkev
beckettkev / Example SetViewXml
Last active November 20, 2019 19:15
Example call to the RenderListDataAsStream endpoint
/_api/web/GetList(@a1)/Views(@a2)/SetViewXml()?@a1=%27%2Fsites%2Fmycustomsite%2FLists%2FMy%20List%27&@a2=%27aaeb6c8a%2Dd013%2D41ec%2D9e44%2Db39b203d0caf%27
@beckettkev
beckettkev / RenderListDataAsStreamPOSTheaders
Last active November 20, 2019 11:22
RenderListDataAsStream POST headers
content-type: application/json;odata=verbose
accept: application/json;odata=verbose
@beckettkev
beckettkev / CreateDemoUsers.csv
Last active March 7, 2019 16:57
A CSV file with
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 11 columns, instead of 10. in line 7.
Firstname,Lastname,StreetAddress,City,PostalCode,Country,Password,Department,Office,UserPrincipalName,DisplayName
Alan,Partridge,1443 Bloomfield Way,London,EN5 1AD,UK,aaiQu9soogae,Sales,Barnet,Alan.Partridge@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Alan Partridge
Bella,Barlow,103 Hedge Street,London,EN5 1AD,UK,S111olaek9,Marketing,Barnet,Bella.Barlow@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Bella Barlow
Keith,Clarke,1342 Freshour Circle,London,EN5 1AD,UK,di6h2oYai,Finance,Barnet,Keith.Clarke@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Keith Clarke
Tilly,Brie,1724 Burke Street,London,EN5 1AD,UK,abh7aiVbi,IT,Barnet,Tilly.Brie@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Tilly Brie
Tim,Apple,1680 Fannie Street,London,EN5 1AD,UK,ux4OopaeKo7,IT,Barnet,Tim.Gray@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Tim Gray
Mark,Davis,3583 Woodland Terrace,London,EN5 1AD,UK,abcikeiloh7,IT,Barnet,Mark.Davis@REPLACEWITHTENANTDOMAIN.onmicrosoft.com,Mark Davis
Ralph,Goodlow,2639 Orphan Road,London,EN5 1AD,UK,9d!p3ohhu,Finance,Barnet,Ralph.Goodl