On the surface, this request sounded super simple and straightforward. “we need to copy files from a SharePoint library to Blob storage.” Simple enough? Well, yes, but the SharePoint library has a couple of required fields and a Flow is triggered by an action.
Consider what I’m outlining below to be version ONE of the process. In the near future, I will update this post with a slightly more resilient solution.
My SharePoint library has a required field titled DesinationFolder
Context of what I’m doing in the Flow: Trigger: When files is created in a folder When a file is added to a library the flow is triggered Get file metadata File Identifier: Use File identifier from the step above Get file properties Id: Use the ItemId from the previous step Initialize variable Name: vCheckedOut Type: Boolean Value: Checked out (field from Get properties) Initialize variable Name: vFolderPath Type: String Value: Condition vCheckedOut is equal to true Yes: Do until vCheckout is equal to False GetFileProperties Set variable Name: vCheckedOut Value: Checked out (value from the Get file properties above) No: Set variable Name: vFolderPath Value: FolderPath (SharePoint field)
Using the Get-PnpSearchCrawlLog cmdlet wanted to filter the returned result set to a specific list. Before you begin, you’ll want to make sure you have access to the Crawl Log: https://yourSite-admin.sharepoint.com/_layouts/15/searchadmin/crawllogreadpermission.aspx
Error I was receiving: System.MissingMethodException: Method not found: ‘System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)’.
I tried uninstalling VScode, removed all traces of SharePoint from my laptop, and cleared the GAC. Nothing worked.
Here is what did work: In VScode:
Open the Command Palette on Windows or Linux with Ctrl+Shift+P. On macOS, use Cmd+Shift+P.
Search for Session.
Click on PowerShell: Show Session Menu.
Choose one of the ___ (x86) options
Not sure how, but I was using an x64 session and SharePoint PNP clearly didn’t like that.
Edit: Updated VScode to the latest version and it managed to reset my session settings. When this happened, it caused my CSOM scripts to report a The remote server returned an error: (400) Bad Request error. The fix above will resolve the error.
Update and a much better way to approach this: Use a SharePoint App Only Client Id and Secret to access the site, list, or library.
Microsoft documentation: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs You can create an app principle that is limited to a single site, list, library, or a combination of them: https://piyushksingh.com/2018/12/26/register-app-in-sharepoint/
In this example, I’m connecting to a Site Collection on my tenant.
1) You have created a token in your o365 site
1.2) On the left site of the page click Security & privacy, then click Create and manage app passwords
1.3) In the app password page click the create button and give it a name.
1.4) Save the password to a secure location.
1.5) There is a better way of doing this that I will cover in a future post.
2) You have downloaded to CSOM DLL(s) from Nuget
Quick and easy way to search for an item across site collections. I would suggest using one of the Keyword query tools to fine-tune your queries. Also note that SharePoint will limit your search results to 10,000 items, but you can page your results and cycle through them. In the example below, I’m searching across all the site collections off of the /sites/ managed path. With the returned dataset, I’m looping through the rows getting the SPFile of each row.
I created a Visual Studio console app.
Added the Selenium WebDriver and the Selenium Chome WebDriver Nuget packages
static void Main(string args)
//set span to 20 seconds
System.TimeSpan span = new System.TimeSpan(0, 0, 0, 20, 0);
//load chrome and the sharepoint library you want to upload to
IWebDriver driver = new ChromeDriver();
driver.Url = "https://yoursite/yourlibrary/Forms/AllItems.aspx";
//click the upload button
//switch the driver focus to the file upload modal
//allow some time for the modal to load
WebDriverWait wait = new WebDriverWait(driver, span);
//get the upload field from the sharepoint modal
IWebElement uploadElement = driver.FindElement(By.Id("ctl00_PlaceHolderMain_ctl02_ctl04_InputFile"));
//use sendkeys to insert the path to the file you want to upload
//click the ok button on the modal
My company recently completed a SharePoint 2010 to 2016 migration. With the migration came the use of HTTPS security, so my OneNote notebooks stored in SharePoint would no longer sync. All of my notebooks displayed an error of Not syncing.
Here is how I fixed the issue:
First, make sure all of your notebooks are in SharePoint.
In OneNote, click on the File tab.
Locate the first notebook you want to update.
Next to the notebook name click Settings, then Properties.
In the Properties window click on Change Location…
Copy the URL of your SharePoint document library.
Paste the URL into the OneNote Chose a sync location… window.
Select the folder you want to sync OneNote with.
Click OK, a message box should appear saying the item is syncing.
Give it a minute and you should be set.
Error: The Web application at https://sharepoint.sharepointed.com could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
I created a .net console app to update some stuff in SharePoint. When executing the .exe file with a new service account, I received the above error.
First I tried granting Shell access to the content db that I was working with but that didn’t solve the problem.
Simple process, using a .Net Web App, create a local file and upload it to SharePoint. I thought the service account I was using had ampel permissions to the Site, but for it didnt… For testing, I granted the seveice account Full Control at the Web App level (user policy), site collection admin, and more. Nothing worked.