Coder Social home page Coder Social logo

sharefile-powershell's Issues

Proxy authentication

Can proxy support be added to the snap-in? My network has recently implemented proxy for all outbound connections, which is less than ideal for scripting scenarios, but it's where I find myself. The ability to add the -Proxy -ProxyCredential -ProxyUseDefaultCredentials switches would help in this situation.

New-SFClient Fails for ShareFile Application Specific Password

I am using the ShareFile PowerShell SDK to call the ShareFile API. Interactive New-SFClient is successful with user name, password and two step verification code. New-SFClient for same account but with an application specific password, thus bypassing the 2SV requirement, fails with "Username or Password was incorrect".

Sync-SfItem System.IO Error

When attempting to sync files from Sharefile to a local drive I get an error -
Sync-SfItem : Could not find a part of the path 'File In Question'
When outputting to a log file it's a System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath).
I logged this issue in an attempt to revisit the problem files later, my goal was to have the syncing continue and ignore the problem path with both -erroraction Continue and $ErrorActionPreference = 'SilentlyContinue' but the sync still stops on the file which has the too long path name.
Any way to get the sync to continue on this error?

Create Report SaveToFolder Not Working

I can create a report with Post Reports however report created is not saved to the folder ID provided. The SaveFolder is populated with the correct Folder object, but the report is not saved to the folder.

Sync-SfItem does not remove deleted from ShareFile files at LocalPath

Tried to sync everything from ShareFile account to local folder. It looks like working OK but ...
Once file is deleted on sharefile and sync operation is started with -Strict switch it does not remove the file from local folder as well
Sync-SfItem -ShareFilePath "/" -Synchronize -Download -LocalPath "C:\sf" -Recursive -Strict

cannot remove access

I tried two options for removing a users access to a folder:

$ACLuser = new-object ShareFile.Api.Models.AccessControl
$ACLuser.Principal = $USER
$ACLuser.CanUpload = $false
$ACLuser.CanDownload = $false
$ACLuser.CanDelete = $false
$ACLuser.CanManagePermissions = $false
$ACLuser.Canview = $false

    Send-SfRequest -Client $sflogin -Method patch -Entity Items -id $folder.id -navigation accesscontrols -Body $ACLuser

Or
Send-SfRequest -Client $sflogin -Method delete -Entity items -id $folder.id -navigation accesscontrols -body $user

In the first instance, it doesn't change the user's access. In the second instance I get an error stating Method Not Allowed.

Judging by the documentation here: http://api.sharefile.com/rest/docs/resource.aspx?name=AccessControls
this should not only be possible, but should be how to accomplish it as well.

Copy files from various onsite directories to corresponding folders in Sharefile

I have several files that need to be uploaded to Sharefile monthly and I would like to use PowerShell to do this. I followed the steps here https://support.citrix.com/article/CTX207460 to add the ShareFile PowerShell snap and installed the Sharefile Powershell SDK from GitHub but need some help.

I tested by doing the following and get the prompt to enter credentials in Sharefile.

Add-pssnapin sharefile
New-sfclient –name “c:\temp\sflogin.sfps”
$sfclient = get-sfclient –name “c:\temp\sflogin.sfps”
New-psdrive –name sf –psprovider sharefile –root / -client $sfclient

This works fine. Then I tested by doing a simple copy from a local directory to a directory in Sharefile as in the example below:
Copy-sfitem c:\Temp\TestFolder-CommunicationTeam\CommunicationsPhoneTree.xlsx sf:/”Disaster Recovery-Business Continuity”\Communications

If no files exist then the file is uploaded fine. However there are three things I am trying to accomplish:

  1. I want to copy select files, not the entire contents of the local directory. I know I can use (Copy-sfitem c:\temp\testfolder* sf:/”Disaster Recovery-Business Continuity”\Communications) and this copies the entire directory. However, I just need to upload two excel files that periodically change each month from a variety of local folders. How do I do this?
  2. I need the files to be overwritten in Sharefile when they are uploaded. This doesn’t happen if I use Copy-sfitem c:\Temp\TestFolder-CommunicationTeam\CommunicationsPhoneTree.xlsx sf:/”Disaster Recovery-Business Continuity”\Communications. How do I add the overwrite parameter in the command?
  3. I would need to copy local files from more than two dozen local directories to corresponding folders in Sharefile. I would like to efficiently do this using a script that doesn’t require me to log into Sharefile as I do when I enter the $sfclient = get-sfclient –name “c:\temp\sflogin.sfps” command as noted above. How do I configure the script with the credentials so this doesn’t need to run interactively? This will enable me to schedule the script to run automatically using the task scheduler.

Thanks,
Roger

Download to windows - file get corrupted

Or at least I think the file is getting corrupted. Not often but say once every couple of thousand downloads.

What I'm seeing is that once I download a file with a command similar to:

Sync-SfItem -ShareFilePath "sfmoveFile:" -Download -OverWrite -Move -LocalPath "$localDownload$dirname"

the file appears in the windows directory as a zero byte file. Now through detailed logs I'm collecting, I know that the file is good in Sharefile but after the download it is 0 bytes.

A workaround I thought of is copy, verify, then delete rather than the sync with the -Move option. But, I have no idea how to delete a file from Sharefile.

Any thought on a real fix or how to delete a file?

Thanks.

-Expand LastAnyLogin not working

Hi,
I need to get LastAnyLogin info, defined in ShareFile.Api.Models.Contact.

I'm trying:
send-sfrequest -client $sfclient -entity accounts\clients -expand LastAnyLogin
Yet this property is not being returned. Any help?

Note: I also tried:
$user = New-Object ShareFile.Api.Models.Contact $user
Returned:

User :
FirstName :
LastName :
Company :
EmailMedium :
EmailShort :
IsConfirmed :
Count :
CreatedDate :
Name :
Email :
Username :
Domain :
MetadataUrl :
__type :
Id :
url :

Thanks

New To Github

Not sure where else to post this. I'm new to Github (thanks for the quick responses on my previous question) so I'm still trying to find my way around here.

So, is there a general discussion area specific to Sharefile? Or even a non-specific discussion area? I have a question which isn't related to an issue with the code so this probably isn't an appropriate area to ask...

Thanks

New-SFClient Error: (400) Bad Request when using -Credential -Account

Starting on 2/14/2020, the New-SFClient cmdlet has been failing with 400 Bad request error when using parameters -Credential. I tried to pass PSCredential object through either New-Object System.Management.Automation.PSCredential($UserName,$Password) or Get-Credential.
The command that is being run is.
New-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\ShareFile.sfps") -Account CompanyName -Credential $Credential

The command works if I remove the -Credential parameter and uses the Popup web authentication to ShareFile.

FileID not found

Where/how do we identify the FileID? We are told how to label it but not where to pull it from.

File and Folder Date

Is there a way to have the Sync-SfItem cmdlet use the create/modify date that's on the original file in sharefile?

Sync-SfItem deviations from sfcli.exe and additional bugs

The download behavior (and upload behavior) contains several bugs and deviations from sfcli.exe. Sync-SfItem does NOT work like sfcli.exe, the documentation claiming so is wrong. I observed the following bugs/deviations and submitted a pull request from my personal branch where the probles are fixed. The following bugs were fixed in my branch, but apply only to downloads. The same faulty logic problems exist in the upload routines and have not been touched.

  1. If 'Move' or 'Synchronize' is used, 'recursive' is no longer forced. This was a deviation from sfcli.exe
  2. When 'CreateRoot' is used and the source is a ShareFile folder, Sync-SfItem would create the parent of the source folder in the destination. This was a deviation from sfcli.exe. Example: If the source on ShareFile was /Folder1/Folder2/Folder3 and -CreateRoot is used, then Sync-SfItem would create Folder2/Folder3 in the destination.
  3. When 'CreateRoot' is not used, Sync-SfItem will still create the parent folder of the items being synchronized in the destination. This was a deviation from sfcli.exe. Example: if the source on ShareFile was /Folder1/Folder2/Folder3 and -CreateRoot is NOT used, then Sync-SfItem would create Folder3 in the destination.
  4. When 'CreateRoot' is used, Sync-SfItem will now behave in one of two ways. If the source is only files, then the parent of those files will be created in the destination. If the source is a folder, the folder will be created in the destination. Otherwise, if 'CreateRoot' is not used, the parent folder is not created at all in the destination. Example: If the source is /Folder1/Folder2/Folder3 and -CreateRoot is used, then Sync-SfItem will create Folder3 in the destination, otherwise no folder is created in the destination and only files (and subfolders, if recursive is used) are copied.
  5. When 'Move' is used, folders would be deleted even when 'KeepFolders' was used if the folder did not have any child items. This was a bug, and a deviation from sfcli.exe. In this scenario, if someone used the -move switch and the source was /Folder1/Folder2/Folder3 and additionally there was a Folder4 subfolder, then Folder4 would be deleted if it was empty, even if -KeepFolders was used.

HttpRequest timeout when getting employees

We have created a scheduled task in our Sharefile server in order to get the number of files of each user. This task executes a Powershell script that use Sharefile API no get the information. Once it is created it runs properly, and if we push it to run every hour, we get some successful exeuctions.

The problem is that, as we want this information only daily, when we see more than one proper hourly execution we changed the frequency to daily. I've checked the execution of the last two days and the result is that we get "HttpRequest timed out" when getting the list of employees of the account.

Which can be the cause of the error in the scheduled task? Before creating the scheduled task in the server I ran the Powershell script in my computer several times for several months And never got that error.

New-SfClient command authentication dialog is failing

I've been using this addin for a couple of years reliably for an automated task. Recently I've been getting errors and thought creating a new client connection file could help.

PS C:\temp> New-SFClient -Name .\connection.sfps

This gives me this:
image

If I then click "Yes" this page will load but entering valid login details doesn't work, the "Sign in" button spins for a couple of seconds then stops.
image

There is no way of completing the authentication to generate the .sfps file with this tool. Note that one of my colleagues is having the same issue.

I suspect this may be related to MS attempting to decommission Internet Explorer, I think this dialog uses the System.Windows.Forms.WebBrowser component which I thinks uses the same engine as IE.

How can I generate a .sfps file without this utility? And does something need to change to get it working again or is it something I'm doing wrong?

Speed up Sync-SfItem

is there a way currently to download multiple files at a time with Sync-SfItem? Or any plans for the future?

Get-SfClient hangs on first run

Every time I run Get-SfClient for the first time in a Powershell session, I get the following error:

Get-SfClient : A task was canceled.
At line:4 char:13

  • $sfClient = Get-SfClient -Name "C:\xxxxxxxx.sfps"
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-SfClient], TaskCanceledException
    • FullyQualifiedErrorId : System.Threading.Tasks.TaskCanceledException,ShareFile.Api.Powershell.GetSfClient

The script runs fine on the second execution. Is there something I'm missing? What would cause something like that to happen?

PowerShell SDK TLS Error

Hey guys!

Is there a permament fix to tackle the PowerShell SDK TLS Errors?

The request was aborted: Could not create SSL/TLS secure channel

We've followed this guide thoroughly:
http://intelligentsystemsmonitoring.com/knowledgebase/citrix/citrix-sharefile-tls-deprecation-upgrade-guidance/

Including the hyperlinks to Citrix Docs. However, the newest version of the PowerShell SDK seems to be 1.92 which we have installed. PowerShell however defaults to TLS 1.1 so as of June 2020 it won't work with ShareFile (having shifted to TLS 1.2).
So we had to expand all of our scripts with the following line:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Is there a known workaround so we don't have to touch all the scripts?

2nd round: Passing PSCredentials to New-SFClient

Hi,
took a while to check this. Are you sure this has been solved?
It looks like that I'm not able to reopen the issue.

I'm running on version 1.3 still having now a different issue running these commands:

$sfCred = Get-Credential
$sfLogin = New-SfClient -Name "$workDir\$sfShortAccountName" -Credential $sfCred

image

Mauricio

Sync-SFItem deleting files that were not moved with the -move option

I am attempting to download files from our Sharefile direcrtory using Sync-SFItem. Once downloaded. I want the downloaded files to be removed from the Sharefile directory. So, for the Sync-SFItem command, I'm using -Move. The problem is that all the files are copied without issue but it seems that everything is deleted - including new files that have arrived after the download started. The behaviour seems to be that only files that existed at the time the Sync was started are download. BUT all the files that exist after the download is finished are delete. Is this an issue? Is there a workaround?

Here is the bit of code I am using to do this task:

New-PSDrive -Name sfWXX -PSProvider Sharefile -Client $sfClient -Root "/WXX" -RootUri
$EFBUnprocessedHome
Sync-SfItem -ShareFilePath "sfWXX:" -Download -OverWrite -Move -LocalPath
$localUnprocessedEFBFlightPlansDir
Remove-PSDrive sfWXX

creating folder try and catch

Sometimes when creating folder i'm getting error message

Send-SfRequest : InternalServerError: A system error occurred.
At C:\Scripts\Sharefile\Sharefile_Copy_Directory\Copy Folder (v2 do not use).ps1:63 char:35

  • ... $folder = Send-SfRequest -Client $sfClient -Entity Items -Method PO ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (Items:String) [Send-SfRequest], Exception
    • FullyQualifiedErrorId : InternalServerError,ShareFile.Api.Powershell.SendSfRequest

I tried to build script which will create folder and retry when fail however script still throwing the same error. Any ideas why?

            $retries = 5 
            $secondsDelay = 2
            $retrycount = 0
            $completed = $false

             while (-not $completed) {
                try {
                    $folder = Send-SfRequest -Client $sfClient -Entity Items -Method POST -Id $rootTarget -Navigation Folder -BodyText $folderInfo
                    Write-Host ("Recreating folder: ", $item.Name,   " successful")
                    $completed = $true
                } catch {
                    if ($retrycount -ge $retries) {
                        Write-Host ("Recreating folder failed the maximum number of {1} times." -f $retrycount)
                        throw
                    } else {
                        Write-Host ("Recreating folder failed. Retrying in {1} seconds." -f $secondsDelay)
                        Start-Sleep $secondsDelay
                        $retrycount++
                    }
                }
            } 

Sharefile Snappin installer issue with Powershell Version 5

Attempting to install the Snappin using the 64 bit msi, I receive the following error.

Installing Sharefile Snapin Installer requires Powershell Version 4.0 or later.

Thing is I have Version 5 installed (5.1.14393.1532)

Any workarounds for this (besides using Powershell 4.0 on another machine or downgrading)?

Thanks

Sync-SfItem : Object reference not set to an instance of an object.

Hello,

when I use the switch -recurse I got the following error, without the switch I don't get any error but I could not copy the subfolders and their content.

Script :

#Variable
$sfClientFile = "C:\Temp\MySubdomain.sfps"
$LocalFolder = "C:\temp\ShareFile"
$Folder = 'Reporting & Insights'

#Prerequisite
#Adding the PsDrive
Write-Host "Adding the PSSnapIn ShareFile" -ForegroundColor Yellow
Add-PSSnapIn ShareFile

#Use an existing login token
Write-Host "Connecting to ShareFile" -ForegroundColor Yellow
$sfClient = Get-SfClient -Name $sfClientFile

#Adding the PsDrive
Write-Host "Adding the PSDrive ShareFile" -ForegroundColor Yellow
New-PSDrive -Name source -PSProvider ShareFile -Root "/" -Client $sfClient

#Copying
Write-Host "Copying the file locally from source:/$Folder to $LocalFolder" -ForegroundColor Yellow
Sync-SfItem -ShareFilePath "source:/$Folder" -Download -LocalPath "$LocalFolder" -Recursive 

Error :

Sync-SfItem : Object reference not set to an instance of an object.
At C:\Temp\Copy-ShareFileToSharePoint.ps1:39 char:9

  •     Sync-SfItem -ShareFilePath "source:/$Folder" -Synchronize -Do ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Sync-SfItem], NullReferenceException
    • FullyQualifiedErrorId : System.NullReferenceException,ShareFile.Api.Powershell.SyncSfItem

Thank for helping.

Folder stopped syncing: Get-SfClient : Object reference not set to an instance of an object.

We have a script running automatically through task scheduler every couple of minutes to sync an in house folder to sharefile

Add-PSSnapIn ShareFile
Set-ExecutionPolicy RemoteSigned
$sfClient = Get-sfClient -Name “C:\Sharefile\Apipowershell.sfps”
New-PSDrive -Name sfdrive -PSProvider ShareFile -Root “/” -Client $sfClient
Sync-SfItem -LocalPath “c:\Scanback\*.*” -Upload -ShareFilePath “/Shared Folders/PAS Scanback” -Move
Remove-PSDrive sfdrive

It worked until 11/24 and now we receive the following error code when this script runs:

PS C:\Users\Administrator> C:\ShareFile\PAS_Upload.ps1
Get-SfClient : Object reference not set to an instance of an object.
At C:\ShareFile\PAS_Upload.ps1:3 char:13

  • $sfClient = Get-SfClient -Name "C:\Sharefile\Apipowershell.sfps"
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-SfClient], NullReferenceException
    • FullyQualifiedErrorId : System.NullReferenceException,ShareFile.Api.Powershell.GetSfClient

New-PSDrive : Cannot bind argument to parameter 'Client' because it is null.
At C:\ShareFile\PAS_Upload.ps1:4 char:68

  • ... rive -Name sfdrive -PSProvider ShareFile -Root "/" -Client $sfClient
  •                                                             ~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [New-PSDrive], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.NewPSDriveCommand

Sync-SfItem : Unable to cast object of type 'System.Management.Automation.PSDriveInfo' to type 'ShareFile.Api.Powershell.ShareFileDriveInfo'.
At C:\ShareFile\PAS_Upload.ps1:5 char:1

  • Sync-SfItem -LocalPath "c:\Scanback*.*" -Upload -ShareFilePath "/Sha ...
  •   + CategoryInfo          : NotSpecified: (:) [Sync-SfItem], InvalidCastException
      + FullyQualifiedErrorId : System.InvalidCastException,ShareFile.Api.Powershell.SyncSfItem
    
    

Remove-PSDrive : Cannot find drive. A drive with the name 'sfdrive' does not exist.
At C:\ShareFile\PAS_Upload.ps1:6 char:1

  • Remove-PSDrive sfdrive
  •   + CategoryInfo          : ObjectNotFound: (sfdrive:String) [Remove-PSDrive], DriveNotFoundException
    
    
    
    

Has anyone else received this issue or can help me decipher whats happenign here?

Help with identifying "paths" > 256 chars

Hoping one or more of you might be able to assist. We're trying to do an urgent move from Sharefile to Sharepoint/Onedrive and we're striking the file path limit in some home directories. We need a means to identify the file/folder combinations that are going to fail in transfer. Any help gratefully accepted. Cheers

Check if device has been unlinked

We want to check from what devices are connected our users. The problem when querying User->Devices we get all the devices that has had the user from the beginning, although they have been unlinked by the user. Is there any way to know if a user has unlinked their Windows Sync?

Send-SfRequest : BadRequest: User must be added as an employee.

I'm trying to create an employee account (not a client) but I always get the same error. I'm not sure what am I doing wrong. When I put some domain of my company, I get the error. When a put a different domain like "@gmail.com" it does work.

Add-PSSnapin sharefile
$sfClient =  Get-SfClient -Name "C:\Users\user\Documents\MySubdomain.sfps"

#create contact in ShareFile
$user = New-Object ShareFile.Api.Models.AccountUser

#required fields
$user.FirstName = "testuser"
$user.LastName = "shafiletest"
$user.Email = "[email protected]"

#create client user
Send-SfRequest $sfClient `
               -Method POST `
               -Entity users `
               -Body $user `
               -Parameters @{"addshared" = "true"}

Passing PSCredentials to New-SFClient

Hi,

following code does not work

$sfUsername = $Lab."Login Name"
$sfPassword = convertto-securestring -String $Lab.Password -AsPlainText -Force
$sfCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $sfUsername, $sfpassword

$sfLogin = New-SfClient -Account $Lab.Account.Substring(0,9) -Credential $SFcred

looks like New-SFClient does not accept the PSCredentials object.

Even if working with
$SFCred = Get-Credentials
it does display the Webform for logging in

FYI:
$Lab is a CSV I'm importing as I need to work with 20 Accounts

Cheers,
Mauricio

Add compatibility for Powershell Core and make this snap-in a module

Powershell versions 5.1 and earlier are no longer in active development. Powershell Core (versions 6, 7, and the future) do not support snap-ins, so the ShareFile-PowerShell SDK is totally unusable.

This should be solvable by making it a module instead of a snap-in. Powershell Core is also based on .NET Core so there may be other considerations.

Copy-sfitem exclude items

I am creating a script, but I need to know how to exclude files using copy-sfitem....I have tried -Exclude, it didn't work

Send-SFRequest not piping objects over to sorting objects correctly

Hi,

next one ;)

I'm fetching all accounts filtering the administrative account

    $sfAccountsEmployees = Send-SfRequest -Client $sfLogin -Entity Accounts/Employees | Where-Object {$_.Email -notlike $sfUsername}
    $sfAccountsEmployeestoDelete = $sfAccountsEmployees  | Where-Object {$_.Email -notlike $sfUsername}

$sfUserName is the Account used for logging on sharefile

As you can see now here in the screenshot filtering does not occur on $sfAccountsEmployees

image

Cheers,
Mauricio

Copy-SFItem from 1 root folder to another

I am trying to copy a root folder and all subfolders & files to another root folder. This works fine but only if the folder is empty. I tried using these switches -Force and -OverWrite, neither work. Anyone know how to get this to keep copying files even when there are already files there ? If they are there it should just skip, even an overwrite would work, just want to schedule this to run monthly but cant figure out a way to get it to go.

Add ShareFile PowerShell Snap-in

Add-PSSnapin ShareFile

#Run the following interactively to create a login token that can be used by Get-SfClient in unattended scripts
#$sfClient = New-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\test.sfps") #-Account YourSubdomain
$sfClient = Get-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\test.sfps")

#Create var
$ProdFolders = "S:\Shared With Me\test1"
$Backup = "S:\Shared With Me\test1archive"

#copy the test root folder to the test archive folder
Copy-SFItem $ProdFolders $Backup

Some documents don't upload using Powershell

Our company has a server where we collect all of the documents users scan in their offices and upload them into ShareFile. We run a powershell script using the ShareFile Snapin x64 module to do the upload.

What we are finding is that some files do not get uploaded, and they are deleted.

From the logs we have set up, I can see that at least one file that was scanned to the server did exist, but never made it through the upload into ShareFile. I checked on the ShareFile folder we were uploading the files to and the audit logs there never showed that specific file showing up. I have an event log that our scan service account which runs the powershell script did delete the file using the powershell.exe process.

99% of the time, this process works with no problems.

We are using the ShareFile SnapIn x64 v1.0, and the powershell script we use is copied below:

Add-PSSnapIn ShareFile
$sfClient = Get-SfClient –Name "D:\SecureScanning\NJCC\NJCC.sfps"
New-PSDrive -Name sfdrive -PSProvider ShareFile -Root "/" -Client $sfClient
Sync-SfItem -ShareFilePath "/SecureScanning" -LocalPath "D:\Customers\NJCC\Scans_NJCC" -Upload -Move -KeepFolders -Synchronize

How can I go about tracking down what is happening to the missing files?

copy files from one location to another

I can move files from one location to another using this command
Send-SfRequest -Client $sfClient -Entity Items -Method PATCH -Id $item.Id.ToString() -BodyText $fileParent
but how to copy it using Send-SfRequest?

Api Giving error for some device Ids

I am writing a piece of code to get the list of devices that our employees have connected. We have seen that for some Device Id, we get an error when getting the device detail using the Id.

This is our piece of code:

`
$sfUsers = Send-SFRequest -Client $client -Entity Accounts\Employees
foreach($sfUserId in $sfUsers) {
$sfEmployee = Send-SfRequest -Client $client -Entity Users -Id $sfUserId.Id -Expand "Devices"
Write-Host $sfEmployee.Email

    foreach($device in $sfEmployee.Devices) {
        $sfDevice = Send-SfRequest -Client $client -Entity Devices -Id $device.Device.Id
    }
}`

This line: $sfDevice = Send-SfRequest -Client $client -Entity Devices -Id $device.Device.Id is what is giving error when querying for some of the received Ids. Which can be the cause?

Download file without passing sharefile account credentials

Hello Everyone, I am looking for help to download a file from sharefile url directly without passing any credentials. Currently, I am manually browsing and downloading the file from sharefile url without passing any credentials. I had looked at the sample scripts but it seems I cannot download file without passing credentials for sharefile account. Can someone please help ?
Thank you.

DisabledUsers.ps1 bug

I know I could probably fix this on my own, but honestly, I'm not sure how to use GitHub well enough to deal with forks and commits. But lines 25 and 26 are not in the right place. You're outputting to the console all users regardless of if they are disabled or not. Those lines should be moved inside the switch statement block.

There is an error in UploadLocalFiles.ps1

A variable rename was missed

Current code:

#upload directory is relative to the root of the account
#get the current user's home folder to use as the starting point
$ShareFileHomeFolder = (Send-SfRequest $sfClient -Entity Items).Url

#use the local My Documents folder as source
$LocalPath = (Join-Path $env:USERPROFILE "Documents")

#Create a PowerShell provider for ShareFile at the location specified
New-PSDrive -Name sfDrive -PSProvider ShareFile -Client $sfClient -Root "\" -RootUri $ShareFilePath

The line:
New-PSDrive -Name sfDrive -PSProvider ShareFile -Client $sfClient -Root "\" -RootUri $ShareFilePath

Should be changed for:
New-PSDrive -Name sfDrive -PSProvider ShareFile -Client $sfClient -Root "\" -RootUri $ShareFileHomeFolder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.