tag:blogger.com,1999:blog-4126985520350746834.post1271971540805810259..comments2024-03-28T07:00:21.554+00:00Comments on Chris O'Brien: Rolling out SharePoint 2013 apps to the enterprise - tenant scope and PowerShell installsChris O'Brienhttp://www.blogger.com/profile/10022906552670607366noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-4126985520350746834.post-46042606943248208752014-08-20T06:21:14.585+01:002014-08-20T06:21:14.585+01:00Thank you Chris and all the commentators.. This po...Thank you Chris and all the commentators.. This post has been posted a while a go and just wanted to see if there was any updates on how installing an app via powershell and trusting there is well. The last solution was an IE script. Anybody?<br /><br />Also it looks like the batch installation for apps that have custom ribbon actions are still not supported :( so we're looking at doing a batch powershell script to do the installs.Karimhttps://www.blogger.com/profile/18167039965644576185noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-22433529473591948432013-11-13T16:20:05.411+00:002013-11-13T16:20:05.411+00:00@Jarno,
Also cool. So are you doing this with CSO...@Jarno,<br /><br />Also cool. So are you doing this with CSOM or some other remote code?<br /><br />Thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-66849147680187058952013-11-13T09:21:15.362+00:002013-11-13T09:21:15.362+00:00@David,
The solution worked perfectly. Using the ...@David,<br /><br />The solution worked perfectly. Using the IE screen didn't even occur to me!<br /><br />There's also a way to automate app part installations. Normally you can't export an app part, and I suspect they set the export mode to "Do not allow" because the .webpart file contains a GUID that refers to the host web (which is obviously always different).<br /><br />What you can do is export the app part (just allow exporting it first from the web part's settings). If you open the .webpart file, you'll notice there's a property element with name 'ProductWebId' in the file. This contains the GUID to the host web that the original app part was exported from, and this needs to be replaced run-time when importing the .webpart file.<br /><br />So, just read the .webpart file into memory, and before adding that file to the web, modify the ProductWebId element's value to reflect the ID of the new host web. Then you can add it programmatically like any other exported web part.<br /><br />I'm pretty sure you can add the ClientWebPart completely programmatically too, but I haven't tried that yet.<br /><br />But thanks again David, with the following steps, I can automate app and app part installations now:<br />1) Upload the app to app catalog<br />2) Install the app to a web (using your approach)<br />3) Install exported app parts to a page by changing the ProductWebId guid<br /><br />JarnoJarno Leikashttps://www.blogger.com/profile/14900236080431399036noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-30996970853736407782013-11-12T21:55:39.780+00:002013-11-12T21:55:39.780+00:00@David,
NICE work! Good thinking to use IE automa...@David,<br /><br />NICE work! Good thinking to use IE automation, especially as part of a build process. <br /><br />Thanks for sharing!<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-6388901345837862342013-11-12T16:53:31.015+00:002013-11-12T16:53:31.015+00:00I have not found any way to trust the app via buil...I have not found any way to trust the app via built in SharePoint PowerShell cmdlets.. BUT, I wrote a 'workaround' to trust it that works good enough for me. Basically I am using the PowerShell Internet Explorer automation to do it.<br /> <br />Here is my sample code, you'll need to modify a few things etc to get it work, but hopefully is a good starting point. I am using this as part of my TFS Build process that builds the app, installs the app, and now trusts it automatically. I used https://officesharepointci.codeplex.com/ for this and then modified it to add this:<br /><br /><br />Write-Host "Trying to trust the app..."<br /><br /> $authorizeURL = "$($web.Url.TrimEnd('/'))/_layouts/15/appinv.aspx?AppInstanceId={$($appInstance.Id)}"<br /> Write-Host "Loading url:" $authorizeURL<br /><br /> $oIE = New-Object -com internetexplorer.application<br /><br /> try<br /> {<br /> $oIE.visible=$true<br /> $oIE.navigate2($authorizeURL)<br /> <br /> sleep -Seconds 1<br /> while ($oIE.busy) {<br /> sleep -milliseconds 50<br /> }<br /> <br /> Write-Host "Loaded Page:" $oIE.Document.Title<br /><br /> sleep -seconds 5<br /> $button = $oIE.Document.getElementById("ctl00_PlaceHolderMain_BtnAllow")<br /> if ($button -eq $null)<br /> {<br /> Write-Host "Could not find button to press"<br /> Write-Host $oIE.Document.documentElement.outerText<br /> }<br /> else<br /> {<br /> Write-Host "Found [Trust It] button, clicking..."<br /> }<br /><br /> $button.click() #click the button, even if it errors (this will give TFS Build a Red error to show)<br /> <br /> sleep -Seconds 1<br /> while ($oIE.busy) {<br /> sleep -milliseconds 50<br /> }<br /> Write-Host "Now we're on page:" $oIE.Document.Title " - " $oIE.LocationURL<br /><br /> #if the button press was successful, we should now be on the Site Settings page.. <br /> if ($oIE.Document.title -like "*trust*")<br /> {<br /> Write-Host "Error: " $oIE.Document.body.getElementsByClassName("ms-error").item().InnerText<br /> throw ("Error Trusting App:" + $oIE.Document.body.getElementsByClassName("ms-error").item().InnerText)<br /> }<br /> else<br /> {<br /> Write-Host "App was trusted successfully!"<br /> }<br /> }<br /> finally<br /> {<br /> $oIE.Quit()<br /> }Anonymoushttps://www.blogger.com/profile/15022231208315914917noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-26682147870305564782013-05-22T10:30:44.918+01:002013-05-22T10:30:44.918+01:00@Anonymous,
Effectively your PowerShell is callin...@Anonymous,<br /><br />Effectively your PowerShell is calling one of the client APIs rather than the server API. You'll need the client API bits on the box which runs the PowerShell.<br /><br />Here's an example by Anders Rask which is used to import SP2013 search configuration (managed properties etc.) - <a href="http://andersrask.sharepointspace.com/Lists/Posts/Post.aspx?ID=42" rel="nofollow">http://andersrask.sharepointspace.com/Lists/Posts/Post.aspx?ID=42</a><br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-91236081227148355982013-05-21T18:39:21.599+01:002013-05-21T18:39:21.599+01:00Hey Chris,
"If you’re on Office 365 (with it...Hey Chris,<br /><br />"If you’re on Office 365 (with it’s limited set of PowerShell cmdlets, as of April 2013), you’ll need to accomplish the same thing using one of the client APIs. I’m starting to form the view that .NET CSOM code “wrapped” with PowerShell is a good way to do this – since it can then be integrated with TFS automated builds etc."<br /><br />How would you do this in office365?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-75647041392047027212013-05-15T15:21:19.112+01:002013-05-15T15:21:19.112+01:00Hi,
I ran into the same issue about the manual tr...Hi,<br /><br />I ran into the same issue about the manual trust like Jarno. Is there a way to set an app trustable by powershell?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-26684745129619803802013-04-15T10:09:44.148+01:002013-04-15T10:09:44.148+01:00@Parham,
This happens when you're trying to s...@Parham,<br /><br />This happens when you're trying to specify a site collection which is NOT associated to the App Catalog you're working with. Remember that App Catalogs are associated at the web application level.<br /><br />Effectively you're going "across the boundary", and will need to either change the App Catalog or site collection being specified.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-86939670903166117292013-04-14T15:41:25.543+01:002013-04-14T15:41:25.543+01:00Hi Chris,
I have installed my custom app, which i...Hi Chris,<br /><br />I have installed my custom app, which is a On-Prom Provider-Hosted app, in my On-Prom app catalog, but I can't deploy my app in the desirable site collections and receive an error saying "The entered site collection is invalid."!!<br /><br />Have you experienced this issue before? Do have any suggestions?<br /><br />Cheers,<br />ParrParhamhttps://www.blogger.com/profile/15364564655585975676noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-73335752679476284002013-04-04T12:20:07.158+01:002013-04-04T12:20:07.158+01:00@Jarno,
Agree on both of those points. On the fir...@Jarno,<br /><br />Agree on both of those points. On the first, I'd like to think that a future update *may* change this - I can't really think of any technical reason why it has to be that way.<br /><br />On the second however, obviously Install-SPApp is effectively skipping that step of the app installer agreeing to the app's Permission Requests. It still needs to happen at some point. It's an interesting question as to whether this can also be accomplished with PowerShell - I haven't yet looked.<br /><br />Obviously all this doesn't apply to tenant-scope apps, because the person who installed it to the App Catalog site agreed to the Permission Requests at that time.<br /><br />Cheers,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-39904678024202784892013-04-04T10:47:23.231+01:002013-04-04T10:47:23.231+01:00I've understood that this "batch installa...I've understood that this "batch installation" also has limitations as to what kinds of artifacts the app is allowed to install (see http://msdn.microsoft.com/en-us/library/fp179896.aspx), e.g. app parts and custom actions can not be provisioned to host webs.<br /><br />Also, we've had some issues with app permissions when using the Install-SPApp cmdlet. Namely, the app needs to be trusted manually at the host web in order to make it work. Have you experienced similar issues?Jarno Leikashttps://www.blogger.com/profile/14900236080431399036noreply@blogger.com