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 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.
In this example, I needed to search a farm for every site under a managed path. BUT, the sites I’m searching for were built using a 3rd part tool and would not correctly appear in the search results. The problem was related to having Trim Duplicates enabled by default. Easy fix… Set your search property trim duplicates = false.
There might be a better way to get this done, but for now, this works for me. Keep in mind, this update works on a per view basis. If I find a way to correctly update the masterpage, I will update this post.
At a high level, you will need to modify the page, add two content editor web parts, and save.
Normal page displaying the Upload button and Drag files here to upload text.
Start by editing the page. Top right of the screen, click the gear icon, then select Edit Page. Once in edit make, add two Content Editor web parts to the page.
Place your cursor in the top web part, select Edit Source in the Format Text ribbon window.
Running this returned domain\yourNameHere, when it should have returned email@example.com.
Navigate to Central Admin, then cruise over to your User Profile Service. Once there, run a full synchronization.
Profile Service –> Synchronization –> Start Profile Synchronization –> Start Full Synchronization
Run the PowerShell script again and it will return the correct data.
Same idea as above but using the SharePoint ClientContext.
using (ClientContext clientContext = new ClientContext("https://webapp.taco/toppings/cheese"))
Web web = clientContext.Web;
var userEmail = web.CurrentUser.Email;