Access Denied on http://products.office.com/microsoft-stream page

Copper Contributor

Hi,

I have a problem with Add-PnPFile.

 

I have two users:
- site administrator (it's me - logged in on the local machine)
- regular user.

 

Both users have write rigths to sharepoint library: both users can edit the library using sharepoint user interface (web).

 

Below is a script which:
- works perfectly when I connect to the sharepoint as site adminstrator,
- fails when I connect to the sharepoint with second (regular) user with permission denied (as below).

Is there any specific sharepoint rights that allow the user to make REST API calls (I understand they are used by PnP scripts)?

---

+ Add-PnPFile -Path test.txt -Folder "Shared Documents\SMS_Export"\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Add-PnPFile], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,SharePointPnP.PowerShell.Commands.Files.AddFile

---
$Sharepoint_User="test@domain.com"
$Sharepoint_Pass="HERE_PASWORD"
$PWord=ConvertTo-SecureString -String $Sharepoint_Pass -AsPlainText -Force
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList
$Sharepoint_User,$PWord

# This method of connecting makes the following add-pnpfile to work OK# Connect-PnPOnline -Url https://mysite.sharepoint.com/sites/test -UseWebLogin

# And this method of connecting makes it fail.Connect-PnPOnline -Url https://mysite.sharepoint.com/sites/test -Credentials $Credential
echo "ASDQWE" > test.txt
Add-PnPFile -Path test.txt -Folder "Shared Documents\Test"
Get-PnPFolderItem -FolderSiteRelativeUrl "Shared Documents\Test"

0 Replies