April 9, 2020 - 14:20, by Steven Van de Craen -
Had the requirement to get the CheckedOutFile collection of a SharePoint List programmatically and it had to include the ItemID for the file (for use in further programmation).
Via PowerShell you can quite easily get the Path Identity information which contains the ItemID:
Notice that the number at the end is the ItemID.
However, via C# CSOM this is a lot harder as the ObjectPathIdentity class is “inaccessible due to its protection level”. You can’t directly get to this info so I created an extension method “GetPath” to get this info:
public static class ClientObjectExtensions
public static string GetPath(this ClientObject o)
string result = null;
if (o != null)
var q = o.GetType().InvokeMember("Path", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, o, null);
var r = q.GetType().InvokeMember("Identity", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, q, null);
result = r.ToString();
Which can be integrated into the C# CSOM logic
Now you can extract this value from the string and continue to work with it as needed.
March 23, 2020 - 11:34, by Steven Van de Craen -
Last week we ran into an issue where external (guest) users on SharePoint Online needed access to custom developed SharePoint Framework Web Parts deployed to the app catalog. By default don’t have access to this location so they receive an access denied on the web part assets.
We brainstormed about deploying to a public CDN but decided against this as it would open up the assets to potentially everyone rather than all our external users. Perhaps this is an unnecessary concern but we’re rolling with it.
A few years ago Microsoft made a change in how guest users receive access to SharePoint by deprecating/disabling the use of “Everyone” or “All Authenticated Users” for external users. See: https://docs.microsoft.com/en-us/office365/troubleshoot/access-management/grant-everyone-claim-to-external-users
While possible to restore this functionality it is better to introduce a dynamic group in Azure Active Directory to identify guest users. Note that this functionality requires Azure AD Premium P1 or higher.
Specify the membership type during group creation:
Next use the rule builder to select all guest users (or other requirements you might have). My query is (user.userType -eq "Guest")
It may take a few minutes before the group membership reflects the rule(s).
Finally, when the group is fully propagated it can be added to the SPO App Catalog with read rights. Note that it might take up to 24 hours (not official) for the group to show up in the People Picker.
Hope this helps.
March 12, 2020 - 16:10, by Steven Van de Craen -
At one of my customers we recently switched to using Microsoft Planner for basic task management and follow up of our team.
When I tried to update several tasks assigned to me I noticed an issue with posting comments:
You no longer have access to "a2e47746-ab52-4774-bba0-905b138c5c7f". Technical details
Correlation Id: 72bb4c8e-f5bb-4f8d-8e3c-03630559263e
Time Stamp: Thu, 12 Mar 2020 11:08:52 GMT
I could change other properties of the task without issues.
FIX: The issue was that my account didn’t have a subscription, more importantly I needed an Exchange Online mailbox. Once that was provisioned the issue was resolved!
March 4, 2020 - 11:00, by Steven Van de Craen -
I was seeing this issue in a SharePoint 2016 environment (Event Log ID 8144 and ULS logs):
Failed to queue mysite for provisioning for user:[domain\user-DELETED-12066432-19B1-4F17-82C9-CF3FC9385325] with correlationid:[12066432-19b1-4f17-82c9-cf3fc9385325] on queue type:[Interactive]. Error:[Microsoft.SharePoint.SPException: The specified user domain\user-DELETED-12066432-19B1-4F17-82C9-CF3FC9385325 could not be found.
at Microsoft.SharePoint.SPWeb.EnsureUser(String logonName)
at Microsoft.Office.Server.UserProfiles.MySiteInstantiationManager.EnsureUserAndFixQuota(String owner, SPSite rootSite)
at Microsoft.Office.Server.UserProfiles.SiteInstantiationWorkItemJobDefinition.<>c__DisplayClass19.<AddWorkItemElev>b__18(SPWeb web)]
This error repeats every 5 minutes as the timer job tries to provision a MySite for this user, however it no longer exists (can happen in some edge case scenario’s mostly related to Active Directory).
Navigate to the User Profile overview, find the user profile and delete it to fix the issue.
February 26, 2020 - 15:17, by Steven Van de Craen -
I’ve been using the new Microsoft Edge (Chromium based, Insider, Chredge, …) ever since the beginning and have loved it from the start. But a recent change (version 79 ?) has an issue with Windows Credentials, something I run into for SharePoint environments with Windows Authentication (NTLM, Kerberos).
Before the update it would prompt with a prefilled credential prompt:
I could just press “Sign in” to continue.
But after the update it would prompt a different style prompt without prefilled credentials or option to save the credentials, forcing me to enter the full username and password every time.
It seems this will be fixed properly in a future update, but for now it is possible to revert to the original credential prompt and functionality via the following workaround:
- Browse to edge://flags/#edge-windows-credentials-for-http-auth
- Change this setting to Disabled (and restart the browser)
Credits & Info: https://techcommunity.microsoft.com/t5/discussions/windows-integrated-authentication-not-working-canary-amp-dev/m-p/934866/highlight/true#M14559
February 6, 2019 - 12:40, by Van de Craen Steven -
"Hey I have a link to a Word document in a SharePoint document library and I have this link on a page to it that I want to open directly in the browser [Word Online]."
"Sure no problem, just append ?web=1 to the link"
"Wow, cool! Can you do the same for opening directly in Word?"
Just linking to the document would offer it as download
I considered a complex hyperlink with an onclick handler that would then open it in Word etcetera etcetera, very convoluted and a thing from the past really.
Then I found out about the Office URI Schemes:
- ms-word:ofe|u| https://mysharepoint/mylibrary/mydocument.docx
ofv = open for view, ofe = open for edit
You can read up on them here: https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes
Even works in emails if you can construct the hyperlink href yourself. In a simple text mail it will not detect as a hyperlink and just render plain text.
Must admit that was a TIL.
February 5, 2019 - 15:18, by Van de Craen Steven -
November 23, 2018 - 16:30, by Steven Van de Craen -
A client who was using TIF files in SharePoint 2016 reported that the search results didn’t link to the file directly, but rather to the List Item Display Form (DispForm.aspx?ID=x) for these files and wanted that changed.
Most info on the web on how to configure for TIF file indexing is rather outdated and incomplete so here’s an update for SharePoint 2016 and 2019.
1. Enable the TIFF iFilter on all servers configured for “Content Processing” in the Search Topology
Install-WindowsFeature -Name "Windows-TIFF-IFilter"
2. [Windows Server 2012 (R2) only] Enable the Windows Search Service Feature on all servers configured for “Content Processing” in the Search Topology
Install-WindowsFeature -Name "Search-Service"
3. Add both tif and tiff to the list of Crawled File Types for the Search Service Application
4. Add both tif and tiff as a file format to the Search Service Application
$ssa = Get-SPEnterpriseSearchServiceApplication
New-SPEnterpriseSearchFileFormat -SearchApplication $ssa tif "TIFF Image File" "image/tiff"
New-SPEnterpriseSearchFileFormat -SearchApplication $ssa tiff "TIFF Image File" "image/tiff"
5. Restart the SharePoint Search Host Controller on all servers configured for “Content Processing” in the Search Topology
6. Run a Full Crawl
You should now have proper indexing of TIF files.
November 20, 2018 - 14:34, by Steven Van de Craen -
I’ve been running various tests and scenario’s with the new SharePoint 2019 that released about a month ago and ran into an issue with the new OneDrive Sync Client (aka NGSC or Next Generation Sync Client).
Sorry, we couldn’t sync this folder. Contact your IT administrator to configure OneDrive to sync SharePoint on-premise folders
Aside from the obvious grammar error (on-premise vs on-premises) I didn’t expect this issue as I had Windows 10, the latest OneDrive client and SharePoint 2019 as outlined here: https://docs.microsoft.com/en-us/sharepoint/install/new-onedrive-sync-client. Except I ignored the part where it says you need to configure Group Policy objects for it to work.
To set up OneDrive with SharePoint Server 2019, configure the following Group Policy objects:
- SharePoint on-premises server URL and tenant folder name The URL will help the sync client locate the SharePoint Server and allows the sync client to authenticate and set up sync. The tenant folder name lets you specify the name of the root folder that will be created in File Explorer. If you don’t supply a tenant name, the sync client will use the first segment of the URL as the name. For example, office.sharepoint.com would become “Office.”
- SharePoint prioritization setting for hybrid customers that use SharePoint Online (SPO) and SharePoint on-premises server This setting lets you specify if the sync client should authenticate against SharePoint Online or the SharePoint on-premises server if the identity exists in both identity providers. Learn how to manage OneDrive using Group Policy
Now a quick way to configure these values is using the registry editor.
- Name: SharePointOnPremFrontDoorUrl
- Type: REG_SZ
- Value: MYSITEHOSTURL
- Name: SharePointOnPremPrioritization
- Type: REG_DWORD
- 0: prioritizes for SharePoint Online (“PrioritizeSPO”)
- 1: prioritizes for SharePoint 2019 (“PrioritizeSharePointOnPrem”)
Once you configure these values you can sync a SharePoint 2019 library with the new sync client.
November 9, 2018 - 11:41, by Steven Van de Craen -
One of my on-prem customers is running Nintex Workflow on SharePoint 2016 and escalated an issue with setting a Taxonomy/Managed Metadata field value via a workflow. They experienced that the workflow would not change the value, or in some case it would but only once.
I managed to scope the issue down to the following:
- It works in SharePoint 2010 but doesn’t in SharePoint 2013, 2016, 2019 (had to spin up a VM of each for proper testing)
- It only affects Workflow Foundation/SharePoint 2010 Workflow Engine workflows (SharePoint Designer can create them, Nintex Workflow on-prem is based on this)
- For files that haven’t been given a value for the managed metadata field the workflow can set the value once. If the field has been set or cleared previously by UI, code, workflow, it will no longer accept new values via the workflow. For Office documents this may not work since background property promotion also causes the issue
So that makes it a pretty narrow scope and explains why there aren’t that many reports on this. But since not everyone is moving to the cloud at the same speed this is still be a relevant issue for some.
I’m going with SharePoint 2016, but I managed to reproduce this in 2013 and 2019 as well.
Create a document library and create a Managed Metadata field with some values and upload a document
Create a new workflow using the “SharePoint 2010 Workflow Platform” (SharePoint Designer or Nintex Workflow)
Configure the workflow to update the Managed Metadata field. This field expects the format TERMLABEL|TERMGUID (I’m using a hardcoded value)
Publish the workflow and run it on new files. For non-Office documents this should work once.
Next, change or clear the value through UI or whatever and run the same workflow again. You should see that even though the workflow has run it could change the value.
Workaround or fix?
I’ve been digging into the internals and it seems that once the managed metadata field is set or cleared, it keeps properties in the SPFile.Properties property bag that interfere with the update process. If you delete these properties and update the SPFile the workflow can update the value (again only once since the properties are added again).
Removing the properties requires an SPFile.Update() which in term creates a new version and is less than ideal.
Escalating this to PSS and hoping for a fix would probably be the right way, but since the narrow scope of the issue and since it is in older technology I have low hopes on this getting fixed soon.
In my case I wrote a Web Service that would allow for updating the Managed Metadata field value through the SharePoint Object Model. And this Web Method can be called in the workflow. It even allows for the workflow designer to specify the type of update (Update, UpdateOverwriteVersion or SystemUpdate). So although not very intuitive the workflow designer can now update Managed Metadata fields through the Web Method, and all other fields through the regular workflow action.