1
votes

I have created several SharePoint hosted apps. Is it possible to create bulk app catalogs because the app is created for a little 100 clients. I don't find a PowerShell command that can do it for Sharepoint office 365 site catalogs.

Is it also possible to upload bulk apps with PowerShell. Don't find much info on the web.

Maybe anyone here has some advice ?

Cheers, Kris

1
Did you succeed already or is it still a problem to you?Niels Verhoeven
Not yet for SharePoint Online. So it's still a problem.Kris

1 Answers

0
votes

it is possible to bulk upload apps to an Office 365 environment as it is for SharePoint on-premise. The tricky part here is that you have to upload the apps to the app catalog, which is in fact a document library.

Recently I created a function using scripts from the internet. Posted the function below:

    function UploadAppToCatalog            
    {            
    [CmdletBinding()]            
    Param(            
    [Parameter(Mandatory=$true,ValueFromPipeline=$true)]            
    [string]$webUrl,            
    [Parameter(Mandatory=$true)]            
    [string]$DocLibName,            
    [Parameter(Mandatory=$true)]            
    [string]$FilePath            
    )                 

    Start-SPAssignment -Global              
    $spWeb = Get-SPWeb -Identity $webUrl             
    $spWeb.AllowUnsafeUpdates = $true;            
    $List = $spWeb.Lists[$DocLibName]            
    $folder = $List.RootFolder            
    $FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)             
    $File= Get-ChildItem $FilePath            
    [Microsoft.SharePoint.SPFile]$spFile = $spWeb.GetFile("/" + $folder.Url + "/" + File.Name)            
    $flagConfirm = 'y'            
    if($spFile.Exists -eq $true)            
    {            
        $flagConfirm = Read-Host "File $FileName already exists in library $DocLibName, do you want to upload a new version(y/n)?"             
    }            

    if ($flagConfirm -eq 'y' -or $flagConfirm -eq 'Y')            
    {            
        $fileStream = ([System.IO.FileInfo] (Get-Item $File.FullName)).OpenRead()            
        #Add file            
        write-host -NoNewLine -f yellow "Copying file " $File.Name " to " $folder.ServerRelativeUrl "..."            
        [Microsoft.SharePoint.SPFile]$spFile = $folder.Files.Add($folder.Url + "/" + $File.Name, [System.IO.Stream]$fileStream, $true)            
        write-host -f Green "...Success!"            
        #Close file stream            
        $fileStream.Close()            
        write-host -NoNewLine -f yellow "Update file properties " $spFile.Name "..."            
        $spFile.Item["Title"] = "Document Metrics Report"            
        $spFile.Item.Update()            
        write-host -f Green "...Success!"            
    }               
    $spWeb.AllowUnsafeUpdates = $false;            


    Stop-SPAssignment -Global              
}