Tuesday, February 5, 2019

BEWARE - SharePoint Online Implicit managed property issue

If you do not want to read the whole story then here is the issue;
Implicit Managed Properties are CASE-SENSITIVE. Make sure you copy and paste the property name in your code. I was using it in Search's REST api and it was not working because I used "deptOWSCHCS" instead of "DeptOWSCHCS" (notice the first letter).

What is Implicit Managed Property?
SharePoint automatically creates a managed property when we create a column. Ex: If you create a site column called Dept with Choice type then SharePoint creates a managed property in the name of "DeptOWSCHCS".
DeptOWSCHCS is called Implicit managed property.

Let's dive into the purpose of this post.

User came to me and asked for a SharePoint page that should display items with the department name. Yes, I have already created the site column "Dept". [This is at high level]

I developed a solution using jQuery + Search REST api.
[You may think why did I choose this method instead of going with CSWP. Well, User gave complex requirement. I just mentioned at high level here for easier understanding.]

On the Search's REST api, there is a property called "selectproperties". Think of something like view fields in CAML query. I mentioned Implicit managed property "deptOWSCHCS". It was working fine for ~8 months.

Suddenly the values of the property (deptOWSCHCS) started returning null values for all the items. Since it is in SharePoint Online, I created a Microsoft support ticket. After many escalations, engineer from Fast search team contacted me. We did lots of troubleshooting.

I dont know what made me to copy and paste the property on the code. [Maybe I was frustrated badly.] It started working. WooHoo........ I found that there is a small letter "d" instead of capital letter "D" in property name DeptOWSCHCS. I asked the engineer. The engineer said, Implicit properties are case-sensitive. I was like WHAAAAAAAAAT!!!!! How come it was working for more than 8 months?

I asked for the documentation on it. Engineer gave me this link where I could not find that information. And engineer responded that it is something like internal information, blah blah.

I understood that the engineer is trying to cover Microsoft's mistake.
My assumption is Microsoft would have pushed some feature that would have caused this issue where no one identified. As a single person, I cannot make Microsoft to rollback the changes. Instead I have changed my code with case-sensitive names.

I have opened an issue on that documentation requesting them to add this information. Therefore developers need not to bang their head on investigating the issue. Because most of the developers do not follow case-sensitive on managed properties.

At the time of writing this post, Microsoft has acknowledged and they would be updating the documentation soon.

My question is; how could they make a change like this without notifying users? It was working fine for ~8 months.

Hope this information is helpful to you.

Sharing is caring !!!!!

Github Issue: https://github.com/MicrosoftDocs/OfficeDocs-SharePoint/issues/296