tag:blogger.com,1999:blog-24682129163265418042024-03-06T22:33:53.868-05:00Sean Regan's Development BlogA resource for tips and solutions involving SharePoint and .NET Developmentsprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.comBlogger104125tag:blogger.com,1999:blog-2468212916326541804.post-74053559422476637202022-09-14T17:07:00.001-04:002022-09-14T17:07:41.388-04:00Microsoft Forms - Transfer Form Ownership<p> To transfer forms for users that are no longer active, just go to:</p><p>https://forms.office.com/Pages/delegatepage.aspx?originalowner=jdoe@email.com</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgd-dmNxP598yCM0Oqo7kET77AI-CgRFrljmjvvTcRj2xrQhw-qJZ99WkWfKgE6Oz3-5oUy30hI7lSmnda2MziCf4bFsonZrZ-38HtecGigc_0qjekwYJncPAgxAMQjzQ8wXtciNhpsAI8fERLTG7sAQtrL4jDr1kCPckvXLwpWHeA09U5n92UIiDvs" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="394" data-original-width="2254" height="112" src="https://blogger.googleusercontent.com/img/a/AVvXsEgd-dmNxP598yCM0Oqo7kET77AI-CgRFrljmjvvTcRj2xrQhw-qJZ99WkWfKgE6Oz3-5oUy30hI7lSmnda2MziCf4bFsonZrZ-38HtecGigc_0qjekwYJncPAgxAMQjzQ8wXtciNhpsAI8fERLTG7sAQtrL4jDr1kCPckvXLwpWHeA09U5n92UIiDvs=w640-h112" width="640" /></a></div><br /><br /><p></p><p>And select which forms you'd like to move, and where to move them!</p>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-53830960635966633202022-09-14T16:37:00.002-04:002022-09-14T16:37:31.739-04:00Microsoft Forms - Finding the Owner of a Form<p>To find the owner of a form, open up the Developer Tools (F12) in your browser, go to the Network Tab -> Fetch/XHR, then look for the one that begins with "ResponsePageStartup", and go to Preview. Expand the form data and you can grab the owner id:</p><p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgbFrA6hjuUDgUwNLVwwO4mci154Tz6rSuPQXERfqAUVwpyIVxobrsAHcoct1i6Iun5qJmeAGEzseiSo-aksW_sXl5adKUm8Wk1fnSEAO1izmzn8DcVMTzJ8DYXhm4OKPt30M7-jF64vcLE1x4_mFXB_Olftxq5M5xlChZyilMudE3rbzcodCU_3gCE" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="749" data-original-width="2254" height="213" src="https://blogger.googleusercontent.com/img/a/AVvXsEgbFrA6hjuUDgUwNLVwwO4mci154Tz6rSuPQXERfqAUVwpyIVxobrsAHcoct1i6Iun5qJmeAGEzseiSo-aksW_sXl5adKUm8Wk1fnSEAO1izmzn8DcVMTzJ8DYXhm4OKPt30M7-jF64vcLE1x4_mFXB_Olftxq5M5xlChZyilMudE3rbzcodCU_3gCE=w640-h213" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div style="text-align: left;">Once you have the ID, you can look it up in Azure AD to find the user.</div><br /></div><br /><br /><p></p>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-3691176855676156552021-07-01T16:23:00.003-04:002021-07-01T16:32:02.967-04:00SharePoint - Add Title Area to a modern page where it's missing<p> I've found pages that for one reason or another are missing the Title Area with the banner. In order to get that back, I just run the following on it (replacing the ID with the ID of the page you're trying to get):</p><p><br /></p><p><span style="font-family: courier;">$SiteURL = "https://vivity.sharepoint.com/sites/Test"</span></p><p><span style="font-family: courier;">$ID = 12</span></p><p><span style="font-family: courier;">Connect-PnPOnline $SiteURL -Credential (Get-Credential)</span></p><p><span style="font-family: courier;">Get-PnPListItem -List SitePages</span></p><p><span style="font-family: courier;">Set-PnPListItem -List SitePages -Identity $ID -Values @{"PageLayoutType"="Article"}</span></p><div><br /></div>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-12655281723655717492021-03-25T12:00:00.003-04:002021-03-25T12:00:35.486-04:00PowerApps - Trouble passing parameters to Power Automate<p> If you connect a Power Automate workflow to a PowerApp, you call the Run() method and can pass it parameters. If the PowerApp isn't allowing you to add parameters to Run(), just select your object and under Action select Power Automate. Remove the Flow and re-add it, and you should then be able to add the parameters you want to pass.</p><p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9ykdMQKeUCaGEoP_-yQKBtYz9ya8oV5PJA4kmadGYZcNkzTKaNDaNJfSVyEc5VLVV8V-AmKq3b1hrjHrRc2CM545CoitgNDQYZ6kci7QGFP2V7euXkIH2KNmiQPXJoJRCOa8D4-d9aN0/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="1244" data-original-width="1438" height="476" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9ykdMQKeUCaGEoP_-yQKBtYz9ya8oV5PJA4kmadGYZcNkzTKaNDaNJfSVyEc5VLVV8V-AmKq3b1hrjHrRc2CM545CoitgNDQYZ6kci7QGFP2V7euXkIH2KNmiQPXJoJRCOa8D4-d9aN0/w549-h476/image.png" width="549" /></a></div><br /><br /></div><br /><br /><p></p>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-91179458378021080452021-02-23T15:29:00.001-05:002021-02-24T10:19:47.747-05:00SharePoint Gallery View - Make images of people bigger<p>The gallery view in SharePoint is great, especially when used to show people. For example, I've created a New Hire list that is populated by a <a href="https://github.com/sregan1/SharePoint-Office365/commit/23f4ca4ec7137a19eaae27b4dda7021e39f7dcae" target="_blank">Powershell script</a> that pulls in any new hires nightly. But the images for the people are tiny:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBsezPaqFx9yXTtQLKUzlTtUh2LdQDaJ-6RkWpnwXnsj_kzFBm1UfecEn_g0JgwSrNe75Lu351QLpeqgyOqWebJ7MncBDLMiNzJYUpvzMAsyDAZhI1XKpNpzzJSeTwBkPfDjyrtixV_TM/s1849/NewHires.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="294" data-original-width="1849" height="102" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBsezPaqFx9yXTtQLKUzlTtUh2LdQDaJ-6RkWpnwXnsj_kzFBm1UfecEn_g0JgwSrNe75Lu351QLpeqgyOqWebJ7MncBDLMiNzJYUpvzMAsyDAZhI1XKpNpzzJSeTwBkPfDjyrtixV_TM/w640-h102/NewHires.png" width="640" /></a></div><p>But it's SO CLOSE to what we're looking for!</p><p>So with a couple of quick edits, you can increase the size of those images.</p><p></p><ul style="text-align: left;"><li>From your Views, select "Format the current view":</li></ul><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiInwsNDkWoAoZ3lALVKlxkAf2CFZRgClAA7PUTq9rnSpuZS2VoL7nB0vv2H95WdIxEdrUF2DpPeEEktaDa1BFE7kG_H_I_2q60Oq4gHGG4p7GghFkW-nU0JY1LRnitIvHruqGgN04zPdo/s581/NewHireView.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="581" data-original-width="282" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiInwsNDkWoAoZ3lALVKlxkAf2CFZRgClAA7PUTq9rnSpuZS2VoL7nB0vv2H95WdIxEdrUF2DpPeEEktaDa1BFE7kG_H_I_2q60Oq4gHGG4p7GghFkW-nU0JY1LRnitIvHruqGgN04zPdo/w97-h200/NewHireView.PNG" width="97" /></a></div><br /><div>And then select on Card Designer, then Advanced Mode</div><div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><br /></div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvlTnkmN-TYykHRiKzJ2PDgZbqTFDLGBceLUtox4chxjZg-VOMcRZNH2dIABWmAh1yJPCyKrdC1DWJY0s-8M6bQhaovBjHFeLJ_1Pl1-NZuKH543ZGokp9OIQILEkPsziBBwoMLZy67Ls/s415/NewHireFormatView.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="390" data-original-width="415" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvlTnkmN-TYykHRiKzJ2PDgZbqTFDLGBceLUtox4chxjZg-VOMcRZNH2dIABWmAh1yJPCyKrdC1DWJY0s-8M6bQhaovBjHFeLJ_1Pl1-NZuKH543ZGokp9OIQILEkPsziBBwoMLZy67Ls/w200-h188/NewHireFormatView.PNG" width="200" /></a> <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQiZi61Pt8x2hOkvaNvOMfDmo1WukdTPWlRD33dUVCQwdFT_0d2pR8hdIOrGCUhPZPS8ulTr6bIe8gx0lkyymXKCiJ-i5agQUD-0jkWcVJJBJXzTiAmq-CHJLzhnG5CatgUzcA65LmXOw/s458/NewHireAdvancedMode.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="458" data-original-width="402" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQiZi61Pt8x2hOkvaNvOMfDmo1WukdTPWlRD33dUVCQwdFT_0d2pR8hdIOrGCUhPZPS8ulTr6bIe8gx0lkyymXKCiJ-i5agQUD-0jkWcVJJBJXzTiAmq-CHJLzhnG5CatgUzcA65LmXOw/w176-h200/NewHireAdvancedMode.PNG" width="176" /></a></div><br /></div>Copy the JSON and paste it into an editor. Do a search for:</div><div><br /></div><div><span style="font-family: courier;">"src": "=getUserImage([$personIterator.email], 'S')"</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: inherit;">And replace the 'S' with an 'L' to bring back the bigger image.</span></div><div><br /></div><div>Next, find the following block:</div><div><br /></div><div><div><span style="font-family: courier;">"forEach": "personIterator in [$NewHire]",</span></div><div><span style="font-family: courier;"> "elmType": "a",</span></div><div><span style="font-family: courier;"> "attributes": {</span></div><div><span style="font-family: courier;"> "class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"</span></div><div><span style="font-family: courier;"> },</span></div><div><span style="font-family: courier;"> "style": {</span></div><div><span style="font-family: courier;"> "display": "=if(loopIndex('personIterator') >= 5, 'none', '')"</span></div><div><span style="font-family: courier;"> },</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: inherit;">Add a width and height property to the style section to the size that you'd like the image to be:</span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"><br /></span></div><div><span style="font-family: courier;"><div>"forEach": "personIterator in [$NewHire]",</div><div> "elmType": "a",</div><div> "attributes": {</div><div> "class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"</div><div> },</div><div> "style": {</div><div> "display": "=if(loopIndex('personIterator') >= 5, 'none', '')"<span style="background-color: #fcff01;">,</span></div><div><span style="background-color: #fcff01;"><span style="white-space: pre;"> </span> "width": "100px",</span></div><div><span style="background-color: #fcff01;"><span style="white-space: pre;"> </span> "height": "100px"</span></div><div> },</div></span></div><br /></div><div><span style="font-family: inherit;">Pasted this JSON back in, save the view and you should be all set!</span></div><div><span style="font-family: inherit;"><br /></span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHdUTpH-DW3qscRCyOq0_ZUw0s8Zdqdso26LUHNL2Qtx5KiWgRzbF_H3Jxa1afzspAO-En2CzF-Vl_eaRFnC81imDET9fv0T8_2jAL72pKuPeCjVPHUrDo_zKSO_rjQQWULm_YqEBMxi8/s1853/NewHiresFinal.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="379" data-original-width="1853" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHdUTpH-DW3qscRCyOq0_ZUw0s8Zdqdso26LUHNL2Qtx5KiWgRzbF_H3Jxa1afzspAO-En2CzF-Vl_eaRFnC81imDET9fv0T8_2jAL72pKuPeCjVPHUrDo_zKSO_rjQQWULm_YqEBMxi8/w640-h130/NewHiresFinal.png" width="640" /></a></div><br /><span style="font-family: inherit;"><br /></span></div><p></p>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-36046950918474667472021-02-01T18:48:00.005-05:002021-02-01T18:52:13.698-05:00Teams: Tasks by Planner - We couldn't save your tab settings<p>If you're an owner of a team and you try to add the Tasks by Planner tab and get the "We couldn't save your tab settings. Please try again.":</p><p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDBUiHvjl3rdo6c5gkrrrWm4HCrRJlQxRWnFrFBbnLCiWwbueqzQnzHX22n0-lJOnf7KoVe2E35Jr6Jf3nOfhtjzUZw7jwR8YvfI0WPrEZdjZr75ul1JAfRfTgaiciXblrXshdIWOHRMM/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="806" data-original-width="858" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDBUiHvjl3rdo6c5gkrrrWm4HCrRJlQxRWnFrFBbnLCiWwbueqzQnzHX22n0-lJOnf7KoVe2E35Jr6Jf3nOfhtjzUZw7jwR8YvfI0WPrEZdjZr75ul1JAfRfTgaiciXblrXshdIWOHRMM/" width="255" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div></div>Just make yourself a member temporarily and then you'll be able to create the tab.<p></p>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-4846415573341031032020-09-30T22:40:00.002-04:002020-09-30T22:40:51.921-04:00Copy all views from one SharePoint list to another via Powershell<p> Here's a PnP Powershell script that copies all views from one SharePoint list to another list:</p><br /><span style="font-family: courier;"># Url to the site<br />$siteUrl = "https://vivity.sharepoint.com"<br /><br /># The list where we want to copy all of the views<br />$listWithViewsToCopy = "Banana"<br /><br /># The list name to copy the views to<br />$listToCopyTo = "Pineapple"<br /><br />Write-Host "Connecting to PnP..."<br />Connect-PnPOnline -Url $siteUrl -Credential (Get-credential)<br /><br /># Get all the views and properties for the list<br />$viewsToCopy = Get-PnPView -List $listWithViewsToCopy -Includes "ViewQuery","ViewType","ViewData","ViewJoins","ViewProjectedFields","RowLimit","Paged"<br /><br /># Loop through each view and create it in the new list<br />foreach ($view in $viewsToCopy)</span><div><span style="font-family: courier;">{<br /> Write-Host "Adding View: "$view.Title<br /> # Loop through all fields and create an array<br /><br /> $fields = [System.Collections.ArrayList]::new() <br /><br /> </span></div><div><span style="font-family: courier;"> foreach ($field in $view.ViewFields)<br /> {<br /> [void]$fields.Add($field) <br /> }<br /><br /> # Add the new view<br /> Add-PnPView -List $listToCopyTo -Title $view.Title -Fields $fields -Query $view.ViewQuery -ViewType $view.ViewType -RowLimit $view.RowLimit<br />} </span><br /></div>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com1tag:blogger.com,1999:blog-2468212916326541804.post-362054121338402872020-06-11T14:12:00.001-04:002021-07-01T16:32:52.993-04:00Power Automate - Grant access to an item or folder: Add a SharePoint GroupIn Power Automate, if trying to grant access to an item or a folder, and you try to use a SharePoint Group, it won't resolve and you'll get an error that the field is required.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghegtiFX6tIsOMawXC-0hIxKTN0OM6a9bMBEfcxGzznc2nCB4GF71PoS7qaWomp8pTiUfZnjTXxSHpWOy40R9GpCZ-flOFoo8SECCzh5QpSo7660IKwpZXO6vJXFF6cdvcMnX1jETg_Rs/s1600/SharePointGroups1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="604" data-original-width="988" height="242" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghegtiFX6tIsOMawXC-0hIxKTN0OM6a9bMBEfcxGzznc2nCB4GF71PoS7qaWomp8pTiUfZnjTXxSHpWOy40R9GpCZ-flOFoo8SECCzh5QpSo7660IKwpZXO6vJXFF6cdvcMnX1jETg_Rs/s400/SharePointGroups1.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
But if you just Initialize a variable and assign it the name of the SharePoint Group:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkJfApZVuD_RKRWMSxdyel0mbJ6GOH-ddultNNnyptsx3KS-tHuMa-s10sxgRKYOz_gGt3kgBuUF6HbTtNhxPdGIUNBSAHzRNHKFyM0ARDvd8PyTtr5l6wNbiH_N11DxlwFY6QbeE9_Ic/s1600/SharePointGroup2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="312" data-original-width="1013" height="122" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkJfApZVuD_RKRWMSxdyel0mbJ6GOH-ddultNNnyptsx3KS-tHuMa-s10sxgRKYOz_gGt3kgBuUF6HbTtNhxPdGIUNBSAHzRNHKFyM0ARDvd8PyTtr5l6wNbiH_N11DxlwFY6QbeE9_Ic/s400/SharePointGroup2.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
And then use that variable instead:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7Pi6pAaNOHDZvGqalO8miCNbPPgeF9z57z-DTHXMmbGh0BBbWu3Bgw6ftxgq1pnT684uvGq4NDAal_60fxMSJKhOnrkpljYYdYVtEnbhY6IU62zkFZfgPsZq6v2DB7FGch-yTcoIVTs/s1600/SharePointGroup.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="629" data-original-width="990" height="253" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7Pi6pAaNOHDZvGqalO8miCNbPPgeF9z57z-DTHXMmbGh0BBbWu3Bgw6ftxgq1pnT684uvGq4NDAal_60fxMSJKhOnrkpljYYdYVtEnbhY6IU62zkFZfgPsZq6v2DB7FGch-yTcoIVTs/s400/SharePointGroup.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You no longer get an error, and the group will get added with the access level specified when you run the flow!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com3tag:blogger.com,1999:blog-2468212916326541804.post-34633841095377757312020-06-08T22:01:00.005-04:002020-06-08T22:01:53.794-04:00Get-PnPListItem in a list with greater than 5000 itemsIf you need to grab all the items from a list with greater than 5000 items in SharePoint Online, you might get the following error:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Times, Times New Roman, serif;">To get around that, add a query with the scope of RecursiveAll to your query like so:</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">Connect-PnpOnline -Url 'https://vivity.sharepoint.com/sites/sitename' -Credentials (Get-Credential)</span><br />
<span style="font-family: Courier New, Courier, monospace;">$query = "<View Scope='RecursiveAll'><RowLimit>5000</RowLimit></View>"</span><br />
<span style="font-family: Courier New, Courier, monospace;">$items = Get-PnPListItem -List 'My List' -Query $query</span>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-71757777818410425262019-10-03T10:54:00.005-04:002021-05-19T15:45:50.088-04:00Display all the sites a user can accessI've heard many people ask for a place to view all the sites they have access to. Using the content search web part you can accomplish this and have a page that by using search, which returns unique results for each user based on their permissions, each user gets a unique list of the sites they can access that looks something like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMHAEWTNw2ISUr5pMD-tfFKqu_Ta7v8xo2ZxaMf46A4e15qnkM6m7Gv3kOJ1EIG0mDvlY6f1v8xQzAMxq16N_xufepAa2hgQpjI_JL8zP4UEGxagGogYSWWmHqW7WOD1VlO7VnbMh6zzo/s1600/Sites+Full.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="668" data-original-width="1600" height="265" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMHAEWTNw2ISUr5pMD-tfFKqu_Ta7v8xo2ZxaMf46A4e15qnkM6m7Gv3kOJ1EIG0mDvlY6f1v8xQzAMxq16N_xufepAa2hgQpjI_JL8zP4UEGxagGogYSWWmHqW7WOD1VlO7VnbMh6zzo/s640/Sites+Full.PNG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
The following steps describe how to create this:<div><br /></div><div><h4 style="text-align: left;"><b>Enable the Content Search Web Part</b></h4><div><div>In the Site Settings, under Site Collection Administration, enable the SharePoint Server Enterprise Site Collection and the SharePoint Server Publishing Infrastructure features. These add the Content Search web part and create the JS files in the Content Web Parts directory.</div><div><br /></div><h4 style="text-align: left;"><b>Upload the template files and css</b></h4>
First, download the the code from the following in github: <a href="https://github.com/sregan1/SharePoint-Office365/tree/master/Sites%20Directory">https://github.com/sregan1/SharePoint-Office365/tree/master/Sites%20Directory</a><br />
<br />
Open up SharePoint Designer and select on All Files in the left hand navigation. Then go to /_catalogs/masterpage/Display Templates/Content Web Parts. Copy Control_Sites_Directory.html and Item_Sites_Directory.html here. Edit the url in these files (where it says "vivity.sharepoint.com") to your url.<br />
<br />
Go to Site Assets, and create a Styles folder (if not there already), and copy SitesDirectory.css there.<br />
<br />
<h4 style="clear: both; text-align: left;"><b>Add the web part and select the templates</b></h4><div class="separator" style="clear: both;">First, add a content search web part to your page and edit it. In the dropdowns, select the newly added Sites Directory for the Control and Item Sites Directory for the item.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVmkJOjpWCAWj_9gaFdoY9MXQSWRZnJUCKR6OEa-5ss84usUkJR9N3EfCSu30dBG_7n_vwsZsfs_jZnKOqiFQBZej34NRGqbXU5u38baIv7fKTv3zfS-lNqrGgQyQymfgVRONcPHDHFUc/s1600/TemplateSettings.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="840" data-original-width="492" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVmkJOjpWCAWj_9gaFdoY9MXQSWRZnJUCKR6OEa-5ss84usUkJR9N3EfCSu30dBG_7n_vwsZsfs_jZnKOqiFQBZej34NRGqbXU5u38baIv7fKTv3zfS-lNqrGgQyQymfgVRONcPHDHFUc/s320/TemplateSettings.PNG" width="187" /></a></div>
<br />
<h4 style="text-align: left;"><b>Setup the web part query</b></h4>Edit the web part and hit the Change Query button, Switch to Advanced Mode and paste in the following "contentclass:STS_Site" into the Query text box<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJhsq5C3I3ATzGSKGdNAEEUrY2GItxXoFGia0emH25RhsqU-m41Zk5LWwPoSmsn7hX2EQe_oIU28zRXjv9RY_XqPXAICyj94HJ6ZoenatAnzwaL8WMy1N0G8dDOiOBVXaGUEs22lSNMzA/s1600/Query.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1091" data-original-width="1242" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJhsq5C3I3ATzGSKGdNAEEUrY2GItxXoFGia0emH25RhsqU-m41Zk5LWwPoSmsn7hX2EQe_oIU28zRXjv9RY_XqPXAICyj94HJ6ZoenatAnzwaL8WMy1N0G8dDOiOBVXaGUEs22lSNMzA/s320/Query.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You might want to remove some sites/paths from the query as needed by using the Property filter (e.g. -Path:https://vivity.sharepoint.com/sites/sitenottoshow). If you want to add subsites as well, make the query text (contentclass:STS_Site OR contentclass:STS_Web).</div><div class="separator" style="clear: both; text-align: left;"><br /></div><h4 style="clear: both; text-align: left;"><b>Map the Site Name to a RefinableString for Search Sorting</b></h4><div class="separator" style="clear: both; text-align: left;">You'll probably want these results to be sorted, so to accomplish that, go to your Content Type Hub and go to Site Settings -> Search Schema (under Site Collection Administration), and then search for "RefinableString". Select one, say RefinableString00, and scroll down to Add a Mapping. Map "ows_SiteName" and press OK. Wait a bit (maybe a day), for the index to update. You'll now be able to sort by RefinableString00. [I usually also give the RefinableString an Alias like SiteName, so it's more clear what you're sorting on]</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
And that should be it!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
NOTE: If some sites aren't showing, just kickoff a re-index of the site in Site Settings -> Search and offline availability...</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>References</b></div>
<div class="separator" style="clear: both; text-align: left;">
The paging functionality was referenced from Sean McDonough's blog here: <a href="https://sharepointinterface.com/category/sharepoint-2007/development/">https://sharepointinterface.com/category/sharepoint-2007/development/</a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div></div>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com4tag:blogger.com,1999:blog-2468212916326541804.post-44523948904193830382018-06-05T16:48:00.000-04:002018-06-05T16:48:50.253-04:00Task Approval by Email RepliesThis post details how to setup a script to process emails, and setup your workflows to send emails that can be processed by the script, so that end users can ultimately just reply to an email and it will get processed and close the task.<br />
<h3>
</h3>
<h3>
Overview</h3>
<div>
We'll setup a script as a scheduled task, that will check a designated inbox for emails to process. It will scan the body of those emails for keywords to approve or reject.</div>
<div>
<br /></div>
<div>
We'll then take a workflow task process, and update the email to have an approve and a reject mailto link, which will open up an email, which when a user sends, will get processed and will update and close the task.</div>
<h3>
</h3>
<h3>
Step 1: Setup Email Inbox</h3>
<div>
The first step is to create an email inbox that we'll use for all processing. In this inbox, create three folders:</div>
<div>
<ul>
<li>Email Approvals</li>
<li>Email Approvals Processed</li>
<li>Email Approvals Not Processed</li>
</ul>
<div>
<a href="https://support.office.com/en-us/article/inbox-rules-in-outlook-web-app-edea3d17-00c9-434b-b9b7-26ee8d9f5622" target="_blank">Create an inbox rule</a> that will move the item to the Email Approvals folder if the subject begins with "REPLY:"</div>
</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT8LWAPQkO3XEOpk5s5cNqIpc0_o3Ch35LkZnTdmxjrf93QSEutCmLMtnijWnao1rRHt4cNj1rjcwcR86zg0pV_t0ZkntbG5hH0uhF0gw6zGrixfmAPE0V138IC5ymcEborRdTPD-Zz7c/s1600/InboxRule.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="301" data-original-width="867" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT8LWAPQkO3XEOpk5s5cNqIpc0_o3Ch35LkZnTdmxjrf93QSEutCmLMtnijWnao1rRHt4cNj1rjcwcR86zg0pV_t0ZkntbG5hH0uhF0gw6zGrixfmAPE0V138IC5ymcEborRdTPD-Zz7c/s640/InboxRule.PNG" width="640" /></a></div>
<div>
<br /></div>
<div>
This Email Approvals folder will be the folder our script will check to process any emails that arrive there.</div>
<div>
<br /></div>
<h3>
Step 2: Setup the script</h3>
<div>
<a href="https://github.com/sregan1/SharePoint-Office365/tree/master/Email%20Approvals" target="_blank">Download the script from github</a>, and change the necessary variables to local paths on your machine. Set it up on the server that it will be running on.<br />
<br />
<h3>
Step 3: Create Encrypted Credentials </h3>
</div>
<div>
The script assumes there are two users, one that has the required permissions to update the task in SharePoint ($UserSharePoint), and one user for the mailbox where the emails are being sent to ($UserEmail). Create encrypted files for each by <a href="http://www.sregan.com/2018/06/using-encrypted-credentials-in.html" target="_blank">following the instructions here</a>, and make sure to match the name and path of the file to the $CredsFileSharePoint and $CredsFileEmail in the script.</div>
<div>
<br /></div>
<h3>
Step 4: Create a Scheduled Task</h3>
<div>
Setup a scheduled task to run the script, and under Actions set the following:</div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</span></div>
<div>
<span style="font-family: inherit;">Add Arguments: "F:\Scripts\EmailApprovals\Process-Email-Approvals.ps1"</span></div>
<div>
<span style="font-family: inherit;">Start in: F:\Scripts\EmailApprovals\</span></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg19OVvaysG2az_TXnQ9z8TWIa1o_DCDIBSPVYo48k1EY76NXeQ6jTixKgxK7nIcgBXH78enZeAbJ53NT61Xu-hV53diIpOyaEzcR06zcU2jr7goJg1lhA7nIl8KJS70Pl6W-YO6MkjSdY/s1600/Action.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="503" data-original-width="464" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg19OVvaysG2az_TXnQ9z8TWIa1o_DCDIBSPVYo48k1EY76NXeQ6jTixKgxK7nIcgBXH78enZeAbJ53NT61Xu-hV53diIpOyaEzcR06zcU2jr7goJg1lhA7nIl8KJS70Pl6W-YO6MkjSdY/s320/Action.PNG" width="292" /></a></div>
<div>
<br /></div>
<h3>
Step 5: Create a Workflow Task Process</h3>
<div>
Next create a workflow with a task process. For the email option, use the following as a template:</div>
<div>
<br /></div>
<h4>
Email to user (sent from workflow)</h4>
<div>
<h2>
<o:p></o:p></h2>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><i>Subject: </i> ACTION REQUIRED: PO 98451 Change Request<o:p></o:p></span></div>
<div style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><i style="mso-bidi-font-style: normal;"><span style="color: #444444; mso-bidi-font-family: "Segoe UI Light";">Body:<span style="mso-spacerun: yes;"> </span></span></i><span style="color: #444444; mso-bidi-font-family: "Segoe UI Light";">A new PO Change
Request has been submitted and requires your approval:<o:p></o:p></span></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><span style="color: #212121;">Title: Requesting a new phone </span><br style="color: #212121;" /><span style="color: #212121;">PO Number: </span>98451<br style="color: #212121;" /><span style="color: #212121;">PO Owner: Jane Doe </span><br style="color: #212121;" /><span style="color: #212121;">Original Amount: $699.00 </span><br style="color: #212121;" /><span style="color: #212121;">New Amount: $799.00 </span><br style="color: #212121;" /><span style="color: #212121;">Description: Upgraded the model</span></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><span style="color: #444444; mso-ascii-font-family: Calibri; mso-bidi-font-family: "Segoe UI Light"; mso-hansi-font-family: Calibri;">Please either approve or
reject the request below:</span><span style="color: #444444;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><a href="mailto:svc_it_apps@paratekpharma.com?subject=REPLY:%20PO%20Change%20Request&body=I%20approve%20the%20following%20PO%20Change%20Request.%0D%0A%0D%0ATitle:%2099887%0D%0APO%20Number:%2099887%0D%0APO%20Owner:Sean%20Regan%0D%0AOriginal%20Amount:%20$5,000.00%0D%0ANew%20Amount:%20$25,000.00%0D%0ADescription:%20%E2%80%8Btesting%0D%0A%0D%0A______________________________%0D%0A%0D%0AFor%20Processing%0D%0A%0D%0Aurl=https://paratekpharma.sharepoint.com/Finance/Lists/POChangeRequestTasks/DispForm.aspx?ID=113&ContentTypeId=0x0108003365C4474CAE8C42BCE396314E88E51F" target="_blank"><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Segoe UI Light"; mso-hansi-font-family: Calibri;">Approve</span></a><span style="color: #444444; mso-ascii-font-family: Calibri; mso-bidi-font-family: "Segoe UI Light"; mso-hansi-font-family: Calibri;"> </span><a href="mailto:svc_it_apps@paratekpharma.com?subject=REPLY:%20PO%20Change%20Request&body=%0D%0A%0D%0AI%20reject%20the%20following%20PO%20Change%20Request%20for%20the%20reasons%20listed%20above.%0D%0A%0D%0ATitle:%2099887%0D%0APO%20Number:%2099887%0D%0APO%20Owner:Sean%20Regan%0D%0AOriginal%20Amount:%20$5,000.00%0D%0ANew%20Amount:%20$25,000.00%0D%0ADescription:%20%E2%80%8Btesting%0D%0A%0D%0A______________________________%0D%0A%0D%0AFor%20Processing%0D%0A%0D%0Aurl=https://paratekpharma.sharepoint.com/Finance/Lists/POChangeRequestTasks/DispForm.aspx?ID=113&ContentTypeId=0x0108003365C4474CAE8C42BCE396314E88E51F" target="_blank"><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Segoe UI Light"; mso-hansi-font-family: Calibri;">Reject</span></a><span style="color: #444444;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #444444; mso-ascii-font-family: Calibri; mso-bidi-font-family: "Segoe UI Light"; mso-hansi-font-family: Calibri;"><span style="font-family: inherit;">PO: https://vivity.sharepoint.com/Finance/Lists/POChangeForm/DispForm.aspx?ID=117</span></span></div>
<div class="MsoNormal">
<br /></div>
<h4>
Mailto Link Sample</h4>
<h2>
<o:p></o:p></h2>
<div class="MsoNormal">
In each email from the workflow, we have a mailto link for
approving and rejecting, which should resemble the following.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: "courier new" , "courier" , monospace;">email.approvals@vivityconsulting.com?subject=REPLY:%20PO%20Change%20Request&body=I%20approve%20the%20following%20PO%20Change%20Request.%0D%0A%0D%0ATitle:%20<span style="background-color: white;">Requesting%20a%20new%20phone</span>%0D%0APO%20Number:%20<span style="background-color: white;">98451</span>%0D%0APO%20Owner:Jane%20Doe%0D%0AOriginal%20Amount:%20$699.00%0D%0ANew%20Amount:%20$799.00%0D%0ADescription:%20%E2%80%8BUpgraded the model%0D%0A%0D%0A______________________________%0D%0A%0D%0AFor%20Processing%0D%0A%0D%0Aurl=https://vivity.sharepoint.com/Finance/Lists/POChangeTasks/DispForm.aspx?ID=117</span><o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<h4>
Mailto Response Email</h4>
<h2>
<o:p></o:p></h2>
<div class="MsoNormal">
Note that the script keys off of certain words, so if
“approve”, “acknowledge” or “yes” is in the body, it will be approved, if
“reject” is in the body text, it will be rejected.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><i>Subject: </i>REPLY: PO
Change Request<o:p></o:p></span></div>
<div style="background: white;">
<span style="font-family: inherit;"><i style="mso-bidi-font-style: normal;"><span style="color: #212121; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Body:</span></i><span style="color: #212121; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="mso-spacerun: yes;"> </span>I approve the following PO Change Request.<o:p></o:p></span></span></div>
<div style="background: white;">
<span style="color: #212121; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: inherit;"><br /></span></span></div>
<div style="background: white;">
<span style="font-family: inherit;"><span style="color: #212121;">Title: Requesting a new phone </span><br style="color: #212121;" /><span style="color: #212121;">PO Number: </span>98451<br style="color: #212121;" /><span style="color: #212121;">PO Owner: Jane Doe </span><br style="color: #212121;" /><span style="color: #212121;">Original Amount: $699.00 </span><br style="color: #212121;" /><span style="color: #212121;">New Amount: $799.00 </span><br style="color: #212121;" /><span style="color: #212121;">Description: Upgraded the model</span></span></div>
<div style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #212121; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: inherit;">______________________________<o:p></o:p></span></span></div>
<div style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="color: #212121; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><span style="font-family: inherit;">For Processing<o:p></o:p></span></span></div>
<div style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: inherit;"><span style="color: #212121;">url=</span>https://paratekpharma.sharepoint.com/Finance/Lists/POChangeTasks/DispForm.aspx?ID=117</span></div>
<div style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><br /></span></div>
<h3 style="background: white; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">Design</span></h3>
<div>
<span style="mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;">The following should be in place for the process to work properly:</span></div>
<div>
<ul>
<li>The link should be to a Tasks lists (as the script is updating task columns)</li>
<li><div class="MsoNormal">
The body of the email received must contain either (case
insensitive):<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]-->Approve<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]-->Acknowledge<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]-->Yes<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]-->Reject</div>
</li>
<li><div class="MsoNormal">
The body must also contain a "url=" with a link to the task
item in the format, which is typically included at the end of the email.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: .75in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;">
</div>
<span style="font-family: "courier new" , "courier" , monospace;">url=<span style="color: windowtext; text-decoration-line: none;">https://vivity.sharepoint.com/IT/Lists/Manager</span>Tasks/DispForm.aspx?ID=387</span></li>
<li>All processing is written out to a log to review any
potential issues. A new file is created
each time the process is run, and this folder can be regularly cleaned up.</li>
</ul>
</div>
<div style="text-indent: -24px;">
<br /></div>
<div>
<span style="mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;"><br /></span></div>
</div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-45906599314264866142018-06-05T15:16:00.001-04:002018-06-05T15:16:13.647-04:00Using Encrypted Credentials in PowerShell<i>*** NOTE: This must be done when logged into the computer running the program, as the user you’ll be running the program as. E.g. if your Scheduled Task is running as sys_admin, you must be logged in as sys_admin on the machine that will be running the scheduled task before encrypting the credentials ***</i><br />
<i><br /></i>
<h4>
Create the Encrypted File</h4>
First create the encrypted text file by running the following:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$cred = Get-Credential</span><br />
<span style="font-family: Courier New, Courier, monospace;">$cred.Password | ConvertFrom-SecureString | Out-File .\adcreds.txt</span><br />
<br />
<h4>
<br /></h4>
<h4>
Using the Encrypted Credentials</h4>
To use the credential file in powershell you can use:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">$User = "sregan@vivityconsulting.com"</span><br />
<span style="font-family: Courier New, Courier, monospace;">$File = "C:\Development\Vivity\adcreds.txt"</span><br />
<span style="font-family: Courier New, Courier, monospace;">$cred = New-Object -TypeName System.Management.Automation.PSCredential `</span><br />
<span style="font-family: Courier New, Courier, monospace;">-ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)</span><br />
<br />
<h4>
<br /></h4>
<h4>
Notes</h4>
If you change the machine or account that this runs as, you will have to recreate this file!<br />
<h4>
<br /></h4>
<h4>
Reference</h4>
<a href="https://practical365.com/blog/saving-credentials-for-office-365-powershell-scripts-and-scheduled-tasks/">https://practical365.com/blog/saving-credentials-for-office-365-powershell-scripts-and-scheduled-tasks/</a>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-88096863235941027172018-05-31T14:09:00.002-04:002018-05-31T14:12:17.668-04:00Using jQuery for ValidationIf you want to make a column required based on non-standard column validation, you can do so via jQuery by creating a function to make the field red and disable the Save button like so:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">function MakeFieldRequired(fieldId) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> $("input[value$='Save']").attr('disabled', true);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> $("span[id^='" + fieldId+"']").css('color','red').css('font-weight','bold');</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<div>
<br /></div>
<div>
<br /></div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-12733823628758242392018-04-10T13:56:00.003-04:002018-04-10T13:56:42.246-04:00Updating a SharePoint Survey ViewIf you want to update the view of a SharePoint survey, like say add a column to view or change the sort order, you have to open up the view in SharePoint Designer, like All Responses:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiC4lAtl8ZciubDPm1yZUK9Trdivm6W880YTKMsm-kGVoM6uJC14bK8eGVyrxS6_cG9YQy9CeORBynD70yf7NoYoEf2yHwssBacoMOp0dwik58quxn0DDknIdnwls2DTrBFSNErCQjGZAc/s1600/Survey2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="153" data-original-width="235" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiC4lAtl8ZciubDPm1yZUK9Trdivm6W880YTKMsm-kGVoM6uJC14bK8eGVyrxS6_cG9YQy9CeORBynD70yf7NoYoEf2yHwssBacoMOp0dwik58quxn0DDknIdnwls2DTrBFSNErCQjGZAc/s1600/Survey2.PNG" /></a></div>
<br />
then find the "View" xml and update accordingly (sorting is in the OrderBy CAML, and you can add FieldRefs to show more columns, etc.)<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><View Name="{D1928BFA-8AFA-4B0D-A5F2-9C5748292299}" Type="HTML" TabularView="FALSE" DisplayName="All Responses" Url="/Lists/Statistics/AllItems.aspx" Level="1" BaseViewID="2" ContentTypeID="0x" ImageUrl="/_layouts/15/images/survey.png?rev=44" ><Query><OrderBy><FieldRef Name="ID" <span style="background-color: yellow;">Ascending="FALSE"</span>/></OrderBy></Query><ViewFields><FieldRef Name="DisplayResponse"/><FieldRef Name="Author"/><FieldRef Name="Modified"/><span style="background-color: yellow;"><FieldRef Name="Active"/></span><FieldRef Name="Completed"/></ViewFields><RowLimit Paged="TRUE">30</RowLimit><JSLink>clienttemplates.js</JSLink><XslLink Default="TRUE">main.xsl</XslLink><Toolbar Type="Standard"/></span><span style="font-family: "Courier New", Courier, monospace;"></View></span><br />
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<span style="font-family: inherit;">and you'll get an updated view:</span><br />
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTfw29AHoDt71zL-p4g33fzXGxGziL0QOfIB8oN93Mzn37QxB2_sQKtmHbW3nfjwJ5QrCoQJ-KCIuSPcmcOHi8bZd0Ue3e5-eG_54zXvLGTIPGXR0MAWx3Jghy_YaUYu_LFQTpEfMY07Q/s1600/Survey1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="326" data-original-width="772" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTfw29AHoDt71zL-p4g33fzXGxGziL0QOfIB8oN93Mzn37QxB2_sQKtmHbW3nfjwJ5QrCoQJ-KCIuSPcmcOHi8bZd0Ue3e5-eG_54zXvLGTIPGXR0MAWx3Jghy_YaUYu_LFQTpEfMY07Q/s400/Survey1.png" width="400" /></a></div>
<span style="font-family: "Courier New", Courier, monospace;"><br /></span>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com1tag:blogger.com,1999:blog-2468212916326541804.post-1379705974227312372018-04-06T22:18:00.000-04:002018-04-06T22:18:11.750-04:00SharePoint Designer: Workflow stuck - Invalid Text ValueIf you have a workflow that gets stuck in a state where it says:<br />
<h4>
"Invalid text value. A text field contains invalid data. Please check the value and try again"</h4>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcxtOnShfTatpVEa0mFbcYdl0sV1QD0moCDe40r0H4oZ0NnFLB00pnVcnbrmDewshC2i1Dpvl3a2s8gi3y41WTuCKjDfXmuMgGsyw49MN1tx-WqIGI6srwtm9kvmq418Yi80_q6fR9OIM/s1600/suspend.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="715" data-original-width="764" height="299" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcxtOnShfTatpVEa0mFbcYdl0sV1QD0moCDe40r0H4oZ0NnFLB00pnVcnbrmDewshC2i1Dpvl3a2s8gi3y41WTuCKjDfXmuMgGsyw49MN1tx-WqIGI6srwtm9kvmq418Yi80_q6fR9OIM/s320/suspend.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You likely have more than 255 characters in a "Log to the Workflow History List", which throws this error.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com7tag:blogger.com,1999:blog-2468212916326541804.post-36863090617660130202018-04-06T21:45:00.000-04:002018-04-06T21:45:40.314-04:00SharePoint Designer Workflow: Passing HTML in url parametersIf trying to pass some html as a url parameter in a link in a SharePoint Designer workflow like below,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7jJb-DckiO5ic-pOpYxzlRg1faBKbTwewyZjG3_q4DwbWoLJgY_uFOcD_BoXqdI9uNuXxwY7ws53hkPhEv0NKCWlRJe4MJ6pGvdS9KCxfewyCWwusGJGPk7KwxDKyokEJz9psHWbkV50/s1600/Hyperlink.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="267" data-original-width="980" height="87" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7jJb-DckiO5ic-pOpYxzlRg1faBKbTwewyZjG3_q4DwbWoLJgY_uFOcD_BoXqdI9uNuXxwY7ws53hkPhEv0NKCWlRJe4MJ6pGvdS9KCxfewyCWwusGJGPk7KwxDKyokEJz9psHWbkV50/s320/Hyperlink.JPG" width="320" /></a></div>
<br />
<br />
if you just add it to a link parameter like so:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">&msg=<h2>Thank you [% Current Item:Assigned To %] for approving<br/><br/>You may now close this tab.</h2></span><br />
<div>
<span style="font-family: "Courier New", Courier, monospace;"><br /></span></div>
<br />
it gets encoded so your < will become %3C, etc. To get around this, if you create a variable and encode it:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg44pJDqjJBAJSDW_4Fogyz-6-kXSlFGMgl2-bCYC3SELqWt_NKP80fuku5lZkwzMk_NRRMirCLZw6pAQGFqyXBbwAbqcl4eOtUEYinzuC2xLhGDmsORN9tv9zithWWGMAnoxMAtV5RWuI/s1600/variable.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="76" data-original-width="939" height="25" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg44pJDqjJBAJSDW_4Fogyz-6-kXSlFGMgl2-bCYC3SELqWt_NKP80fuku5lZkwzMk_NRRMirCLZw6pAQGFqyXBbwAbqcl4eOtUEYinzuC2xLhGDmsORN9tv9zithWWGMAnoxMAtV5RWuI/s320/variable.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
like so:</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">%3Ch2%3EThank%20you%20[% Current Item:Assigned To %]%20for%20approving%20your%20direct%20reports%20for%20this%20fiscal%20quarter.%3Cbr%2F%3E%3Cbr%2F%3EYou%20may%20now%20close%20this%20tab.%3C%2Fh2%3E</span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzxCPV8OgAeBwVhshsutV9DQeWKymBFdFWlRnSmM1O1vdsYx4bWxJEctLDb8JrgZ_PIDWc-1aMm0mZocGbygsCgr7Ut697_NOEmfk9wV5TAjXFdXkfh5A7GLBSG1NzkdbIyo79w9k2GSs/s1600/htmlvariable.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="921" data-original-width="1058" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzxCPV8OgAeBwVhshsutV9DQeWKymBFdFWlRnSmM1O1vdsYx4bWxJEctLDb8JrgZ_PIDWc-1aMm0mZocGbygsCgr7Ut697_NOEmfk9wV5TAjXFdXkfh5A7GLBSG1NzkdbIyo79w9k2GSs/s320/htmlvariable.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
then you can just use the variable in the link and it will display as you'd like it:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj49g3CCxsdDV4kY-rrqHQt5Sg4CNJmXQei4UsGu_IYAhyU8VeKaXuP8NWtK07XN-wswSL0UIu1WArdGqcmbrXcU2rF1DZHW0Vq16oTjugLyr-mCNG0f0sWJTarTH8UBdDs58JDKeWKOWc/s1600/linkstringbuilder.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="911" data-original-width="1045" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj49g3CCxsdDV4kY-rrqHQt5Sg4CNJmXQei4UsGu_IYAhyU8VeKaXuP8NWtK07XN-wswSL0UIu1WArdGqcmbrXcU2rF1DZHW0Vq16oTjugLyr-mCNG0f0sWJTarTH8UBdDs58JDKeWKOWc/s320/linkstringbuilder.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Courier New, Courier, monospace;">&msg=<h2>Thank%20you%20Sean%20Regan%20for%20approving.<br%2F><br%2F>You%20may%20now%20close%20this%20tab.<%2Fh2></span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com3tag:blogger.com,1999:blog-2468212916326541804.post-80609062986846731062018-04-06T16:45:00.001-04:002018-04-06T16:50:00.890-04:00SharePoint Survey: Creating a Friendly Error MessageIf you have a SharePoint survey that is set to only allow a single submission per user, if a user tries to submit again they get a nasty system error:<br />
<br />
<h4 style="text-align: center;">
Sorry, something went wrong<br />You are not allowed to respond again to this survey</h4>
<div>
<br /></div>
<h4 style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyD3MvtvxwrntwYmYQ0a2EbfSEvDobQgJrhuCVJCm8fivFsl4qCMJQjZQK8CtkB91XkUDC1Rn0b-lTqXD1KmhqO2D7VyrDLZVURkqeeK6gUHCZ6W7_D79t3vmj1tr1Kx_WjPidq8bUag/s1600/systemerror.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="251" data-original-width="463" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyD3MvtvxwrntwYmYQ0a2EbfSEvDobQgJrhuCVJCm8fivFsl4qCMJQjZQK8CtkB91XkUDC1Rn0b-lTqXD1KmhqO2D7VyrDLZVURkqeeK6gUHCZ6W7_D79t3vmj1tr1Kx_WjPidq8bUag/s320/systemerror.PNG" width="320" /></a></h4>
<div>
<br /></div>
<div>
To create a more user friendly error message, you can create a new page, add some javascript in it, and display either a friendly message like:</div>
<div>
<br /></div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggV35edsJTYtAQsZDtGsYHfztMfAleWhvNKMPTk_j29Jj2oAsLh0rrYKtbT1BrEhPt5eFaH3PfoOC-Nvpsa8_ts143IsqkqJyNtH89I6FKhc4WBfjA6-p5N8h5ffJFo9EvLA8Qx-hwRjg/s1600/FriendlyError.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="189" data-original-width="587" height="103" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggV35edsJTYtAQsZDtGsYHfztMfAleWhvNKMPTk_j29Jj2oAsLh0rrYKtbT1BrEhPt5eFaH3PfoOC-Nvpsa8_ts143IsqkqJyNtH89I6FKhc4WBfjA6-p5N8h5ffJFo9EvLA8Qx-hwRjg/s320/FriendlyError.png" width="320" /></a></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Or if they haven't taken the survey it will redirect them there. </div>
<div>
<br /></div>
<div>
Simply send out a link to your new page with a (list) path and a (list) title parameter like so:</div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">https://vivity.sharepoint.com/Pages/Survey-Check.aspx?path=/Lists/Survey/NewForm.aspx&title=Survey</span></div>
<div>
<br /></div>
<div>
The code is in my github below, just link the javascript into a Content Editor Web Part:</div>
<div>
<br /></div>
<div>
<a href="https://github.com/sregan1/SharePoint-Office365/tree/master/Survey%20Friendly%20Error%20Message" target="_blank">https://github.com/sregan1/SharePoint-Office365/tree/master/Survey%20Friendly%20Error%20Message</a></div>
<div>
<br /></div>
<div>
And below:</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><script type="text/javascript" src="/_layouts/15/sp.js"></script></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><script type="text/javascript"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>function getParameterByName(name) {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>var url = window.location.href;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>name = name.replace(/[\[\]]/g, "\\$&");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>results = regex.exec(url);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>if (!results) return null;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>if (!results[2]) return '';</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>return decodeURIComponent(results[2].replace(/\+/g, " "));</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>function readSurveyVotes(cbSurveyResult)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>var listTitle = getParameterByName("title");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var context = new SP.ClientContext.get_current();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var web = context.get_web();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var list = web.get_lists().getByTitle(listTitle);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var viewXml = '<View><Where><Eq><FieldRef Name="Author"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where></View>';</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var query = new SP.CamlQuery();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> query.set_viewXml(viewXml);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var items = list.getItems(query);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> context.load(items);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> context.add_requestSucceeded(onLoaded);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> context.add_requestFailed(onFailure);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> context.executeQueryAsync();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> function onLoaded() {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> var voteCount = items.get_count();</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> cbSurveyResult(voteCount)</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> function onFailure() {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> cbSurveyResult(null);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>$(document).ready(function() {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>var listPath = getParameterByName("path");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>var listTitle = getParameterByName("title");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> //Read survey for current user to find out if he have already voted </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> readSurveyVotes(function(votesCount){</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> //if voted then display custom message </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> if(votesCount > 0) {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> survey-check-message.innerHTML = "<h2>You already took the " + listTitle + " survey, thank you for checking!</h2>";</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> }</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> //if not, call original function for opening response form</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> else {</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> survey-check-message.innerHTML = "<h2>Redirecting to " + listTitle + " survey...</h2>";</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> window.location.href = listPath;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> } </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> });</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span style="white-space: pre;"> </span>});</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"></script></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><div id="survey-check-message" /></span></div>
</div>
<div>
<br /></div>
<div>
I based my code from the following:</div>
<div>
<br /></div>
<div>
<a href="https://sharepoint.stackexchange.com/questions/64357/friendly-message-when-user-tries-to-take-the-survey-again" target="_blank">https://sharepoint.stackexchange.com/questions/64357/friendly-message-when-user-tries-to-take-the-survey-again</a></div>
<h4 style="text-align: center;">
</h4>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<br /></div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-7025929316111066432018-03-16T13:01:00.003-04:002018-03-16T13:01:35.470-04:00Inserting text/html into a list formIf you want to insert text or html into a list form, you can use the following jquery, where you basically target the ID of a control, and insert a row above it:<br />
<br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"><script src="https://code.jquery.com/jquery-3.3.1.min.js"></script></span></span><br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"><script type="text/javascript"></span></span><br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"><span style="white-space: pre;"> </span>$(document).ready(function() {<span style="white-space: pre;"> </span></span></span><br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"><span style="white-space: pre;"> </span>$('<tr><td colspan="2"><br/>Please add your notes here:</td></tr>').insertBefore($("input[id^='Body']").closest('tr'));</span></span><br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"><span style="white-space: pre;"> </span>});</span></span><br />
<span style="color: #222222; font-family: Courier New, Courier, monospace;"><span style="font-size: 12.8px;"></script></span></span><br />
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><span style="background-color: white; color: #222222; font-size: 12.8px;"><br /></span></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvqi8RWky586DODvhi0eMfT4bzpIB2MXEmWZqKjVXOAOkhy2pOsGqr8SML_ownNdX_MecdgXvaOKd212bzxevuLjje_lbupcfYgMaZyQWSphKaeBJS7JhuuCiLCXlaslgNcflzfsenx6k/s1600/InsertText.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="378" data-original-width="565" height="267" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvqi8RWky586DODvhi0eMfT4bzpIB2MXEmWZqKjVXOAOkhy2pOsGqr8SML_ownNdX_MecdgXvaOKd212bzxevuLjje_lbupcfYgMaZyQWSphKaeBJS7JhuuCiLCXlaslgNcflzfsenx6k/s400/InsertText.PNG" width="400" /></a></div>
<span style="font-family: Courier New, Courier, monospace;"><span style="background-color: white; color: #222222; font-size: 12.8px;"><br /></span></span>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-12394333794226155642018-03-09T09:12:00.001-05:002018-03-09T09:25:38.324-05:00Creating a New Hire Workflow...Using Tasks Created Dynamically from a SharePoint ListThe following describes how to create a workflow that uses tasks that are updated in a regular SharePoint list, allowing your end users to create/edit/remove/assign tasks in a SharePoint list, so they never have to open up SharePoint Designer.<br />
<br />
It's a process I like to use for a new hire process or for offboarding, or any situation where tasks tend to change regularly.<br />
<br />
It essentially involves building:<br />
<ul>
<li>New Hire list - this is the list your users will be filling out to kick off the new process, and contain all the information about the new hire</li>
<li>Task Administration list - Create a custom list that will store the tasks we want to be created when the workflow runs</li>
<li>Tasks list - that will store the tasks that will get created and assigned to users</li>
<li>Workflow - loops through each item and assigns the tasks to the users at runtime</li>
</ul>
<br />
<div style="clear: both;">
and the process is:</div>
<div style="clear: both;">
</div>
<ul>
<li>Somebody fills out a form to add a new hire</li>
<li>This kicks off the workflow</li>
<li>The workflow loops through the Task Administration list, creating tasks in the Tasks list</li>
<li>Everyone assigned a task gets an email at the end</li>
</ul>
<br />
<h3 style="clear: both;">
New Hire List List</h3>
<h3>
<div style="font-size: medium; font-weight: 400;">
The new hire list collects the information about the new hire, and kicks off the process. </div>
<div style="font-size: medium; font-weight: 400;">
<br /></div>
<div class="separator" style="clear: both; font-size: medium; font-weight: 400; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia98o3UpZiwFyb3Wj6v5yzqeDAs4arWaMKxD7Y-HJ8OZYdh42GVsvUBPZZ7jbICTsSn_-Cugykz_395wY1yBeHsDFRu637H8k8RaGAO2pBUZIYBzPzxJhJgttXwY-1gAMquU-EFe5woPw/s1600/NewHireList.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="353" data-original-width="806" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia98o3UpZiwFyb3Wj6v5yzqeDAs4arWaMKxD7Y-HJ8OZYdh42GVsvUBPZZ7jbICTsSn_-Cugykz_395wY1yBeHsDFRu637H8k8RaGAO2pBUZIYBzPzxJhJgttXwY-1gAMquU-EFe5woPw/s400/NewHireList.PNG" width="400" /></a></div>
<div>
<br /></div>
</h3>
<h3>
Task Administration List</h3>
<div>
The Task Administration list is just a custom list with the following fields: </div>
<div>
<ul>
<li>Title - this will be the name of the task that will get created, e.g. "Create AD Account"</li>
<li>Assigned To - this is the person or group the task will be assigned to</li>
<li>Task Type - [Task or Notification] - I use this to distinguish if I should create a task, or just send an email notification</li>
<li>Task Active For - [Employees & Non-Employees, Employees or Non-Employees] - this determines whether the task should get assigned for different categories of users</li>
</ul>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3pOw2uTOsuw6_UVoTgyqSfG2tBthLLVH9a0nAWeChoVZWmkuEPUaEadaUNxQwrpio8D0uTSkm7ZiOgnNxoGULFLXWimUqYy1yjCWlqG0if3XTHgMX301OLkXN9kx61gnbwC5Hq0MXbhs/s1600/TaskAdminList.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="317" data-original-width="622" height="203" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3pOw2uTOsuw6_UVoTgyqSfG2tBthLLVH9a0nAWeChoVZWmkuEPUaEadaUNxQwrpio8D0uTSkm7ZiOgnNxoGULFLXWimUqYy1yjCWlqG0if3XTHgMX301OLkXN9kx61gnbwC5Hq0MXbhs/s400/TaskAdminList.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h3 style="clear: both; text-align: left;">
Tasks List</h3>
<div>
The Tasks list is just an OOB Task list:</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHDR5G1wUTr5xGXb0Qor7hH4FHCUosaizFMU1iiy6-eT3SjnhtJAj5H-jZ6fsQFINFuIdB501hevd9MrvA5CkCtrS76wbAoiXrX6TONXABIHTPhYN0UKAVbu9uDtLYHxVWBgot889tA20/s1600/Tasks.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="279" data-original-width="576" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHDR5G1wUTr5xGXb0Qor7hH4FHCUosaizFMU1iiy6-eT3SjnhtJAj5H-jZ6fsQFINFuIdB501hevd9MrvA5CkCtrS76wbAoiXrX6TONXABIHTPhYN0UKAVbu9uDtLYHxVWBgot889tA20/s320/Tasks.PNG" width="320" /></a></div>
</div>
<h3>
Workflow</h3>
<div>
The workflow essentially just queries our Task Admin List, loops through each item, creates a task, and keeps a running list of who to email at the end (so everyone gets just one email no matter how many tasks are create for them).</div>
<div>
<br /></div>
<div>
In this example I also added two extra bits of functionality:</div>
<div>
<ul>
<li>I added a "Task Active For" column in the Task Admin list, which specifies if a task is needed for Employees, Non-Employees, or both. The workflow checks this and assigns tasks accordingly</li>
<li>I also added a "Task Type" column in the Task Admin list. If marked as a Task, a task gets created. If a Notification, it just sends an email to the users assigned, and no task is created.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEC_MxmD_-juOset9W7sK3BVrHLGe7Ohao2svFMVjrxthpVJ472hqFReofYtFzYCaBJoxfEa-JXUQUNbFrYV3rDh-0bTZfHYWlZG4DeTNAcfpYzcYy2LVdlhLiEJZjxA7MmrbTKW61Lpw/s1600/DynamicWorkflowFinal.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="938" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEC_MxmD_-juOset9W7sK3BVrHLGe7Ohao2svFMVjrxthpVJ472hqFReofYtFzYCaBJoxfEa-JXUQUNbFrYV3rDh-0bTZfHYWlZG4DeTNAcfpYzcYy2LVdlhLiEJZjxA7MmrbTKW61Lpw/s1600/DynamicWorkflowFinal.png" /></a></div>
<div>
<br /></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com1tag:blogger.com,1999:blog-2468212916326541804.post-39419173346774968002018-02-07T18:34:00.000-05:002019-06-18T11:40:09.653-04:00Display all Sites and Documents a user can access in SharePoint<h3>
Summary</h3>
<div>
<br /></div>
<div>
This post walks you through the steps of creating a page that will display every shared document, folder and site that's been shared with a user, avoiding the reliance on email links when items are shared. The end result looks something like below.<br />
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBiGB8pRh7Mr-lwAPh3EpmIiWL7v7LnPI_1SGEBG7zBZwNKdAgqmeRfZpDyi7MtXtIDijJzgV39vXoLn2JZISz9jdxRTD3UOCROoQmAFab3gJprIHpUEgqbuZbn3ABeWmnSdj_1Oecwi0/s1600/SharedDocuments.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="691" data-original-width="888" height="311" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBiGB8pRh7Mr-lwAPh3EpmIiWL7v7LnPI_1SGEBG7zBZwNKdAgqmeRfZpDyi7MtXtIDijJzgV39vXoLn2JZISz9jdxRTD3UOCROoQmAFab3gJprIHpUEgqbuZbn3ABeWmnSdj_1Oecwi0/s400/SharedDocuments.PNG" width="400" /></a></div>
<br />
<h3>
Solution</h3>
<div>
<br /></div>
<div>
Search can bring back everything a user has access to. So by modifying the Search Content Web Part, I brought back all files, folders and sites. I updated the Display Templates to show the sites that the documents are in, and added a hover panel that has a document preview and shows the path where the document lives.</div>
<div>
<br /></div>
<div>
I added a Search Refinement Web Part, that displays all of the sites along with the item count under each site. This way a user can easily drill down into different areas.</div>
<div>
<br /></div>
<div>
And lastly I added a search box so that users can perform a search on the results to aid in finding specific items.<br />
<br /></div>
<h3>
Setting up the web parts</h3>
<div>
<br /></div>
<h4>
Search Content Web Part</h4>
<div>
<br /></div>
<div>
First I created a page and added a Search Content Web Part. In order to bring back all files/folders/sites, so I changed the Query text to be:</div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Path:"https://vivity.sharepoint.com" -Path:"https://vivity.sharepoint.com/SiteAssets/" ContentTypeId:0x0120* -ProgID:OneNote.Notebook -ContentTypeId:0x012002* -ContentTypeId:0x012000C0* -ContentTypeId:0x0120001928* ContentTypeId:0x010100* {QueryString.searchTerm}</span><br />
<br />
Which searches my site, leaves out SiteAssets and OneNote Notebooks, and brings back derivatives of the contenttypes I want (files, folders and sites). I am also searching for the querystring parameter "searchTerm", so a wildcard is thrown in the url as a default, which is replaced if a user submits a search.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1d_hZlCktOE9UdjA13IawhqK2xvr5sZ4ok4YIL8YurAboEgPfcPPbjJ3le9O09FeISMhxYsCaLaZPmvEBCB1LYPRbyLLJSKnAQqZUxjVXvJ5AX43tAAroXAODJYOXJlVOg_h1aKBrLbM/s1600/QueryText.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="569" data-original-width="606" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1d_hZlCktOE9UdjA13IawhqK2xvr5sZ4ok4YIL8YurAboEgPfcPPbjJ3le9O09FeISMhxYsCaLaZPmvEBCB1LYPRbyLLJSKnAQqZUxjVXvJ5AX43tAAroXAODJYOXJlVOg_h1aKBrLbM/s320/QueryText.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I also mapped the <span style="font-family: "courier new" , "courier" , monospace;">ows_SiteName </span><span style="font-family: inherit;">crawled property to RefineableString02 and am sorting by that.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Next, I wanted to update my Display Templates (<span style="font-family: "courier new" , "courier" , monospace;">/_catalogs/masterpage/Display Templates/Content Web Parts</span>). I started out with the <span style="font-family: "courier new" , "courier" , monospace;">Control_ListWithPaging.html</span> and the <span style="font-family: "courier new" , "courier" , monospace;">Item_TwoLines.html</span> and modified those. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;">Control_ListWithPaging</span> became <span style="font-family: "courier new" , "courier" , monospace;">Control_GroupedSites_WithHover</span>, and I added some paging logic <a href="http://dineshkumar-sharepoint.blogspot.com/2015/10/adding-paging-numbers-to-control-list.html" target="_blank">from here</a>. I also added a javascript file that sets some variables I'll be using, and adds some styling to my display template.</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;">Item_TwoLines</span> became <span style="font-family: "courier new" , "courier" , monospace;">Item_GroupedSites_WithHover</span>, and my goal here was to display the documents, and added some code to make the Site Title be the header for every set of documents.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I also wanted more contextual information about each document, so I added a hover panel, which I updated to display the folder path and a document preview.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
To show the hover panel, I started with the <span style="font-family: "courier new" , "courier" , monospace;">/_catalogs/masterpage/Display Templates/Item_Default_HoverPanel.html</span> file, and merged it with the <span style="font-family: "courier new" , "courier" , monospace;">Item_Word_HoverPanel.html</span> file, making some slight modifications to make it more generic and show the folder path so we have some context of where the document lives. I named it <span style="font-family: "courier new" , "courier" , monospace;">Item_Default_HoverPanel_SharedDocuments.html</span>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h4 style="clear: both; text-align: left;">
Search Refiner Web Part</h4>
<div>
<br /></div>
<div>
Additionally, users usually have a sense of where a document lives that they're searching for, so I added a Search Refinement web part that lists all of the sites that are returned an displays them so you can drill down easily.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx-7Q9ZNj8Jq1Sc41VjT9ujEy_6WFoni5UsFMwV1GT0M-paWGQSiaaZrTSJ9roitciFhTTVrRP9ozsAgnFOoLGCzoJEAqVX0-CuXzG8qg5RQBcV7KHoQ63ZXUJWW1aFdawyFPa6JUuiA0/s1600/Refiners.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="171" data-original-width="840" height="81" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx-7Q9ZNj8Jq1Sc41VjT9ujEy_6WFoni5UsFMwV1GT0M-paWGQSiaaZrTSJ9roitciFhTTVrRP9ozsAgnFOoLGCzoJEAqVX0-CuXzG8qg5RQBcV7KHoQ63ZXUJWW1aFdawyFPa6JUuiA0/s400/Refiners.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
and when you select a site, it will only bring back those items:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDzve22fOypiU7XNOjNqiaZPA1oyUuwq_y9A96GPLvVThEgDHNomer_8dwROeR9ccCYWr6w3KTNSFdg9Z_4EQfa4rlSADZnBdNgWl5R5Kf3nurdtVyiLwrShh9gWP_S3F92CU9Qy_AaN8/s1600/Refined.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="730" data-original-width="359" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDzve22fOypiU7XNOjNqiaZPA1oyUuwq_y9A96GPLvVThEgDHNomer_8dwROeR9ccCYWr6w3KTNSFdg9Z_4EQfa4rlSADZnBdNgWl5R5Kf3nurdtVyiLwrShh9gWP_S3F92CU9Qy_AaN8/s320/Refined.PNG" width="157" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I updated the refiner templates so that they display in a table format, and you can find these updates in <span style="font-family: "courier new" , "courier" , monospace;">/_catalogs/masterpage/Display Templates/Filters/Control_Refinement_SharedDocuments.html</span> and <span style="font-family: "courier new" , "courier" , monospace;">Control_Refinement_SharedDocuments.html</span>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<h4 style="clear: both; text-align: left;">
Search</h4>
<div>
<br /></div>
<div>
Lastly I wanted a way for users to be able to search at any point, so I added a Content Query Web Part with some html/javascript that simply adds a querystring parameter and resubmits the page, and the the Content Search Web Part uses as a search term.<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1IPbg6km3rm080skwA4xshPVd4cYRnHluRN9gML3Crwn8xZBzQpTntEB45akKjNZAI1nF2DaAwYJFL2eC299fNDY0_X0eS3Lul-ZAUxo1ENvRMn24zIZUpZHKlFj0Rviykg-ytmx8U88/s1600/SearchSnippet.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="100" data-original-width="513" height="62" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1IPbg6km3rm080skwA4xshPVd4cYRnHluRN9gML3Crwn8xZBzQpTntEB45akKjNZAI1nF2DaAwYJFL2eC299fNDY0_X0eS3Lul-ZAUxo1ENvRMn24zIZUpZHKlFj0Rviykg-ytmx8U88/s320/SearchSnippet.PNG" width="320" /></a></div>
<h4 style="clear: both; text-align: left;">
Code</h4>
<div>
<br /></div>
<div>
All the code, templates and web parts are up on my github: <a href="https://github.com/sregan1/SharePoint-Office365/tree/master/Shared%20Documents" target="_blank">https://github.com/sregan1/SharePoint-Office365/tree/master/Shared%20Documents</a></div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-50131507876521330112018-01-29T22:53:00.000-05:002018-02-01T12:35:51.015-05:00Refresh Mapped SharePoint Folders & Fix the "Not Accessible" Error Message<h3>
PROBLEM</h3>
If you have mapped network drives to SharePoint document libraries, when accessing it from File Explorer you'll occasionally get the error:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAPNAfB9b20HsRuPCDt1uA7lMdQEMar8_XA1PbDf4P6syOrtzYlwEvYnfCxQ7i0ipIvbputHyeW6oNH4apzuqXmZvOUo1g8sYd5pqKI_WhENnfDiKp-jcGVgDsGXTgNgQz1xmqwn_zHyw/s1600/error.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="181" data-original-width="478" height="151" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAPNAfB9b20HsRuPCDt1uA7lMdQEMar8_XA1PbDf4P6syOrtzYlwEvYnfCxQ7i0ipIvbputHyeW6oNH4apzuqXmZvOUo1g8sYd5pqKI_WhENnfDiKp-jcGVgDsGXTgNgQz1xmqwn_zHyw/s400/error.jpg" width="400" /></a></div>
<blockquote>
<span style="font-family: "times" , "times new roman" , serif;">[path to your folder] is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.</span><br />
<span style="font-family: "times" , "times new roman" , serif;"><br />
Access Denied. Before opening files in this location, you must first add the website to your trusted sites list, browse to the web site, and select the option to login automatically.</span></blockquote>
There doesn't seem to be any way you can make this completely go away, but by using some javascript to mimic the action, you can create an easy way for your end users to correct that problem.<br />
<br />
<h3>
SOLUTION</h3>
<div>
Our solution was to create a desktop shortcut, which users can double-click, that will reauthenticate the user and remedy the issue.</div>
<div>
<br /></div>
<div>
When clicked, an instance of IE will be opened, to a page where we will mimic the "Open with Explorer" functionality, and ultimately the File Explorer will be displayed.</div>
<div>
<br /></div>
<div>
So let's get started.</div>
<div>
<br /></div>
If you create a page on your site (e.g. OpenWithExplorer.aspx), add a content web part, and in the html add the following code:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><script type="text/javascript"></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>function getParameterByName(name, url) {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> if (!url) url = window.location.href;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> name = name.replace(/[\[\]]/g, "\\$&");</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> results = regex.exec(url);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> if (!results) return null;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> if (!results[2]) return '';</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span> return decodeURIComponent(results[2].replace(/\+/g, " "));</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>}</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>$(document).ready(function() {</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>// This is the default url to open if no parameter is passed</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>var url = 'https://vivity.sharepoint.com/Documents';</span><br />
<span style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>// See if there is a url parameter, if so grab it.</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>var qsUrl = getParameterByName("url", window.location.href);</span><br />
<span style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>// If it exists, change the default url</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>if (qsUrl != null)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>{</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>url = qsUrl;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>}</span><br />
<span style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>// Open up Explorer with our url</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>CoreInvoke('NavigateHttpFolder', url, '_blank');</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="white-space: pre;"> </span>});</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"></script></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
Then create a desktop shortcut (right-click on the Desktop, select New -> Shortcut), and set the target to:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">"C:\Program Files\Internet Explorer\iexplore.exe" https://vivity.sharepoint.com/Pages/OpenWithExplorer.aspx?url=https://vivity.sharepoint.com/sites/HR/Shared%20Documents</span><br />
<br />
with the url parameter the path to the folder you want to open.<br />
<br />
and set the Start in to: <span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;">"</span><span style="font-family: inherit;">C:\Program Files\Internet Explorer</span><span style="font-family: "courier new" , "courier" , monospace;">"</span></span>, and optionally change the icon.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhlGsMZcAxYm5XMoQcKNmr0Xi2RbOz0qlNXa5_6uglxQtHd3ZHvQbe3mnUHRSctEI3sRMv-W8bb7QgJSwp3grAiDfnAFVj93a8LJO5_clZ3W-ud-tYkQ89GKHP12kbwyDBW9deonH4Bj0/s1600/openwithexplorer.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="814" data-original-width="824" height="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhlGsMZcAxYm5XMoQcKNmr0Xi2RbOz0qlNXa5_6uglxQtHd3ZHvQbe3mnUHRSctEI3sRMv-W8bb7QgJSwp3grAiDfnAFVj93a8LJO5_clZ3W-ud-tYkQ89GKHP12kbwyDBW9deonH4Bj0/s320/openwithexplorer.JPG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You'll then have an icon on your desktop, which when you double-click it will:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
1) Open up an instance of IE</div>
<div class="separator" style="clear: both; text-align: left;">
2) Open up the library in File Explorer</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiDysBJi9WQ8XRd3yKfaXTOQyZpE6LqMXgqPH-G9rkhYrkB2Ia93LN3sSSvBRBEd_xqItRPgjTE5VBs_5PLndSZNnVcNC1XJsBHf06lNfcCgudtDdTDcfzKgY4vB7tcrjsfznq4nUexMc/s1600/OpenInExplorer.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="138" data-original-width="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiDysBJi9WQ8XRd3yKfaXTOQyZpE6LqMXgqPH-G9rkhYrkB2Ia93LN3sSSvBRBEd_xqItRPgjTE5VBs_5PLndSZNnVcNC1XJsBHf06lNfcCgudtDdTDcfzKgY4vB7tcrjsfznq4nUexMc/s1600/OpenInExplorer.PNG" width="100" /></a></div>
<div style="clear: both; text-align: left;">
<br /></div>
<div style="clear: both; text-align: left;">
Or you can just as easily create a powershell script and run it with a hidden IE window:</div>
<div style="clear: both; text-align: left;">
<br /></div>
<div style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">$ie = new-object -com "InternetExplorer.Application"</span></div>
<div style="clear: both;">
<span style="font-family: "courier new" , "courier" , monospace;">$ie.navigate("https://vivity.sharepoint.com/Pages/OpenWithExplorer.aspx")</span></div>
<div>
<br /></div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-24526975215659426522017-12-14T13:50:00.001-05:002017-12-14T14:12:40.094-05:00List all Files & Folders for External Users (and Internal Users too)This happens regularly with external users, and sometimes with internal users: Someone shares a document or a folder with you, and you receive an email link to that item, and unless you bookmark that location, you're constantly referring to the email for the link. Now when you're shared many files and folders, this can quickly get out of hand.<br />
<br />
So a quick solution for this is to make a page that users can go to, that will display all of the folders and documents they have access to, like below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovsc9Oz37LfjBNCMgcVoI8fNrbH2cgO1jG7-dAzgDwdhcRPJzKsLmicidJ1ocN3rKtw0TfTV5zDkzRNspEdRW-W1D4MHvAuz7CK0qUNOllL0Zm-QeQ_3LYTF99w-7NOyWPoGxZU6ZNUo/s1600/useraccess.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="388" data-original-width="1038" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgovsc9Oz37LfjBNCMgcVoI8fNrbH2cgO1jG7-dAzgDwdhcRPJzKsLmicidJ1ocN3rKtw0TfTV5zDkzRNspEdRW-W1D4MHvAuz7CK0qUNOllL0Zm-QeQ_3LYTF99w-7NOyWPoGxZU6ZNUo/s640/useraccess.png" width="640" /></a></div>
<br />
This is just a page with two Search Content web parts, and a new Display Template. For the Display Template:<br />
<br />
<br />
<ul>
<li>First make a copy of the Item_TwoLines.html file on the site collection you're in, and name it something else, e.g. Item_UserAccess.html.</li>
<li>Change the title to "User Acces": </li>
</ul>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><title>User Access</title></span><br />
<ul>
<li>Replace the mso:ManagedPropertyMapping line with the following:</li>
</ul>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: white; color: #222222; font-size: 12.8px;"><mso:ManagedPropertyMapping msdt:dt="string">&#39;Link URL&#39;{Link URL}:&#39;Path&#39;,&#39;Line 1&#39;{Line 1}:&#39;Title&#39;,&#39;Line 2&#39;{Line 2}:&#39;Title&#39;</mso:</span><wbr style="background-color: white; color: #222222; font-size: 12.8px;"></wbr><span style="background-color: white; color: #222222; font-size: 12.8px;">ManagedPropertyMapping></span></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: white; color: #222222; font-size: 12.8px;"><br /></span></span></div>
<div>
<ul>
<li>You can then update the content in the display template by replacing the cbs-item div with the following:</li>
</ul>
</div>
<br />
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "arial" , sans-serif;"> </span><span style="font-family: "courier new" , "courier" , monospace;"> <div class="cbs-Item" id="_#= containerId =#_" data-displaytemplate="<wbr></wbr>Item2Lines"></span></div>
<div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> <div class="cbs-Detail" id="_#= dataContainerId =#_"></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> <h3>_#= line1 =#_</h3></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"><!--#_</span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;">if(!line2.isEmpty)</span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;">_#--></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> <div class="cbs-Line2 ms-noWrap" title="_#= $htmlEncode(line2.<wbr></wbr>defaultValueRenderer(line2)) =#_" id="_#= line2Id =#_"></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> <span style="white-space: pre-wrap;"> </span><a class="cbs-Line1Link ms-noWrap ms-displayBlock" href="_#= linkURL =#_" title="_#= $htmlEncode(line1.<wbr></wbr>defaultValueRenderer(line1)) =#_" id="_#= line1LinkId =#_">_#= line2 =#_</a></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </div></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"><!--#_</span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;">_#--></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </div></span></div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"> </div></span></div>
</div>
<div style="background-color: white; color: #222222; font-size: 12.8px;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="background-color: white;">
<ul>
<li>Once these changes are made, save your file.</li>
<li>Then go to Site Settings -> Master pages and page layouts -> Display Templates -> Content Web Parts -> Item_UserAccess.html and select "Publish a Major Version"</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqt4hhVmmSbcdPjnZLvQQXOwpTkY4kZ0T72h0sy1k5KJsgdlALUxyr1EooS-kryKacF79a5HQkPxW0Bo0kcxg9LAHz-3Wl_viqTieCmDi8HVaVLN8N2xl2Hyy_27ShPPjggp2AM37RrRU/s1600/Publish.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="396" data-original-width="583" height="271" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqt4hhVmmSbcdPjnZLvQQXOwpTkY4kZ0T72h0sy1k5KJsgdlALUxyr1EooS-kryKacF79a5HQkPxW0Bo0kcxg9LAHz-3Wl_viqTieCmDi8HVaVLN8N2xl2Hyy_27ShPPjggp2AM37RrRU/s400/Publish.PNG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Next, add a Search Content web part, change the query text to:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>For Folders</b></div>
<div class="separator" style="clear: both; text-align: left;">
Path:"https://yoursite.sharepoint.com/teams/teamsites/" -Path:"https://yoursite.sharepoint.com/teams/teamsites/SiteAssets/" ContentTypeId:0x0120* -ProgID:OneNote.Notebook -ContentTypeId:0x012002* -ContentTypeId:0x012000C0* -ContentTypeId:0x0120001928*</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Where the ContentIDs above are bringing back folders, excluding OneNote Notebooks and MicroFeed folders. And we're excluding SiteAssets which generally most everyone has access to.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>For Documents</b></div>
<div>
Path:"https://yoursite.sharepoint.com/teams/teamsites/" -Path:"https://yoursite.sharepoint.com/teams/teamsites/SiteAssets/" ContentTypeId:0x010100*</div>
<div>
<br /></div>
<div>
Next update the items to show, change the Display Template to "List with Paging" and your new display template "User Acces":</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW3JHyjEXKHyhkExrqybCN6AybdpiJmn5TXl6TTfQniFPj1Mcp4_4ACnufK4X2zfuhlbV49aO1bkCNeama1rF7Unb0jE2g0a9beEAWiw6WjWk34iQUue0_U3Pb9ifukCFuJABVfir0Z58/s1600/searchwebpart.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="385" data-original-width="238" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW3JHyjEXKHyhkExrqybCN6AybdpiJmn5TXl6TTfQniFPj1Mcp4_4ACnufK4X2zfuhlbV49aO1bkCNeama1rF7Unb0jE2g0a9beEAWiw6WjWk34iQUue0_U3Pb9ifukCFuJABVfir0Z58/s320/searchwebpart.PNG" width="197" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
And that should be it!</div>
<div>
<br /></div>
</div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-81751831545094389912017-12-07T10:46:00.002-05:002017-12-07T10:46:20.297-05:00SharePoint Designer Workflow suspended when you have a blank lookup fieldI've noticed an issue when you're using a SharePoint Designer workflow, and you use the <span style="font-family: Courier New, Courier, monospace;">Current Item:LookupField </span><span style="font-family: inherit;">in a task or an email, and that lookup value is blank, and you're setting it to use Lookup Values, Comma Delimited</span><br />
<span style="font-family: inherit;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQ5MfQM9EXOD3HkBEAifMS6sHw_Jh7bCzL2FvQTe-dPJR6jBQQxOczVn9l9u32-niugAQjv6GxndV5uLNOrzdxgCOsuI6KTS_gZ19eO2r0RTp2Sb630d9JV9QVYiy-o2F4ZTDd3qgLLI/s1600/LookupValues.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="177" data-original-width="392" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQ5MfQM9EXOD3HkBEAifMS6sHw_Jh7bCzL2FvQTe-dPJR6jBQQxOczVn9l9u32-niugAQjv6GxndV5uLNOrzdxgCOsuI6KTS_gZ19eO2r0RTp2Sb630d9JV9QVYiy-o2F4ZTDd3qgLLI/s320/LookupValues.png" width="320" /></a></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
You'll get an error of something like: <br />
<br />
<span style="font-family: Courier New, Courier, monospace;">System.InvalidOperationException: Values must be bound to a non-null expression before ForEach activity 'ForEach<DynamicValue>' can be used.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
If you set it as a string, you'll see the JSON that's coming back, and for empty values it returns the string: <br />
<br />
<span style="font-family: Courier New, Courier, monospace;">{"results":null}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: inherit;">Since Designer can't seem to handle that null object, for any lookup values you can do the following:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">1) Save the value as type String</span><br />
<span style="font-family: inherit;">2) Test for the empty/null case by testing for the </span>{"results":null} string<br />
3) Then set the value accordingly<br />
<br />
So in my case, I've setup my lookup values as such: <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh1JFDJ579_wyj81QlIQnHfKSVKRV2pQLCTFaVmDfQe04hJckjz1DxPgML6AjD8hFNtJfmvO8wXaT9oIVheEr6OycppzTixgqq-74soctEpcEnJqWyIqy52q1jT8923ubp3f_5zqy3Uvk/s1600/SetLookupValue.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="183" data-original-width="356" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh1JFDJ579_wyj81QlIQnHfKSVKRV2pQLCTFaVmDfQe04hJckjz1DxPgML6AjD8hFNtJfmvO8wXaT9oIVheEr6OycppzTixgqq-74soctEpcEnJqWyIqy52q1jT8923ubp3f_5zqy3Uvk/s320/SetLookupValue.png" width="320" /></a></div>
<br />
Where in Step 1 I'm using Current Item:Site Access As String, and inside the if statement I'm using the Current Item:Site Access as Lookup Values, Comma Delimited.sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com8tag:blogger.com,1999:blog-2468212916326541804.post-24066374687122737342017-09-29T14:13:00.001-04:002017-09-29T14:13:16.159-04:00Azure AD: Get All User Properties / AttributesTo get all of the Azure AD user properties, you can add a format-list at the end and that should do the trick:<br />
<br />
<span style="background-color: white; color: #222222; font-size: 14px;"><span style="font-family: Courier New, Courier, monospace;">Get-msoluser -UserPrincipalName your.user@yourdomain.com | FL</span></span><br />
<span style="background-color: white; color: #222222; font-size: 14px;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU2eB2rBol3Koz9nMbK_sqJpWZV2Nug-Lbr6uXt3WxrjKVoX0lWlQS-EKbC4z0id-RLyJ8qJb-yAs7GxpLkhyphenhyphenCOoZrE8NuThepYLoxRWoFeMmznlWRbV953XX8OGGZ726CkNfASUNqgNk/s1600/AzureAD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="995" data-original-width="853" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU2eB2rBol3Koz9nMbK_sqJpWZV2Nug-Lbr6uXt3WxrjKVoX0lWlQS-EKbC4z0id-RLyJ8qJb-yAs7GxpLkhyphenhyphenCOoZrE8NuThepYLoxRWoFeMmznlWRbV953XX8OGGZ726CkNfASUNqgNk/s640/AzureAD.png" width="547" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="background-color: white; color: #222222; font-size: 14px;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></span>sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0tag:blogger.com,1999:blog-2468212916326541804.post-78790806508290624042017-09-13T11:31:00.001-04:002017-09-13T11:31:45.555-04:00Set and Unset Multi-Select Lookup field values in SharePoint OnlineIf you ever need an event to set the values of a multi-select lookup field in SharePoint, you can use the following:<br />
<br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>function SetLookup() </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// define the items to add to the results (i.e already selected) this the visual part only </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>var $resultOptions = "<option title='MyValue' value='2'>MyValue</option>"; </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// this is the list of initial items (matching the ones above) that are used when the item is saved. '|t' is the divider </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>var $resultSpOptions = "2|tMyValue"; </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// remove the option selected. NOTE: These are in alphabetical order and thus this ID may differ from the select value </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>//$("[id$='_SelectCandidate'] option:eq(1)").remove(); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='_SelectCandidate'] option[value='2']").remove();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// append the new options to our results (this updates the display only of the second list box) </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='_SelectResult']").append($resultOptions); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// append the new options to our hidden field (this sets the values into the list item when saving) </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='MultiLookup']").val($resultSpOptions); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>function UnsetLookup() </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// define the items to add to the results (i.e already selected) this the visual part only </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>var $resultOptions = "<option title='MyValue' value='2'>MyValue</option>"; </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// this is the list of initial items (matching the ones above) that are used when the item is saved. '|t' is the divider </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>var $resultSpOptions = "2|tMyValue"; </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// remove the option selected. NOTE: These are in alphabetical order and thus this ID may differ from the select value </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='_SelectResult'] option:eq(1)").remove(); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='_SelectResult'] option[value='2']").remove(); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// append the new options to our results (this updates the display only of the second list box) </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='_SelectCandidate']").append($resultOptions); </span><br />
<span style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// append the new options to our hidden field (this sets the values into the list item when saving) </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>var value = $("[id$='MultiLookup']").val();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>value = value.replace($resultSpOptions, "");</span><br />
<span style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>//alert('value: ' + value);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$("[id$='MultiLookup']").val($resultSpOptions); </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>//Execute the Query.</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$(document).ready(function(){</span><br />
<span style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>// In this case, we're triggering by a dropdown named DropdownToTrigger</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>$('select[title="DropdownToTrigger"]').on('change', function() {</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>if ($(this).val()=='Something') </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>SetLookup();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> } </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> else</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> {</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>UnsetLookup();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span> }<span style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>});</span><br />
<span style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span style="white-space: pre;"> </span>});</span><br />
<div>
<br /></div>
sprsprsprhttp://www.blogger.com/profile/16007047566857697703noreply@blogger.com0