Tuesday, March 5, 2019
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
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
Monday, December 17, 2018
SharePoint Online: How to add multiple class names to SPFx web part
If you had override the CSS using Content editor web part on Classic experience then you would have faced big problem in SPFx.
Yes, you cannot override the CSS design because CSS preprocessor adds some random characters at the end dynamically. So you cannot override.
You might think why do I need to provide design customization for users in SPFx.
Here is my requirement:
I want to build a web part that displays restricted port numbers in table format. It will have regular table structure with header and body. Something like below.
Site owners can add this web part on their team site if they want. They might have different color themes applied. If they want to change the header's background to red then we cannot go and develop a web part for their team site. Instead we can provide a multi line text box on property pane and allow users to add their design customization. (Note: You will have to add )
Earlier it was like this;
Hope you find it useful.
Happy coding !!!!!
Yes, you cannot override the CSS design because CSS preprocessor adds some random characters at the end dynamically. So you cannot override.
You might think why do I need to provide design customization for users in SPFx.
Here is my requirement:
I want to build a web part that displays restricted port numbers in table format. It will have regular table structure with header and body. Something like below.
| Restricted Ports |
|---|
| 80 |
| 12345 |
Believe me, my users are very technical and they know how to play with CSS designs.
Here's how to add multiple class names;
<div className={[styles.panelStyle,'customclass'].join(' ')}>
Earlier it was like this;
<div className={styles.panelStyle}>
Hope you find it useful.
Happy coding !!!!!
Wednesday, August 22, 2018
SharePoint Online: Content search web part is not displaying all refinable values
Have you ever be in this situation where you do not see all refinable values under mapped refinable property in CSWP?
You are not alone. :)
Here's what happened;
Business requirement:
- Want to display particular department items
Solution:
- Use CSWP and configure the refiners section.
Implementation:
- I have a created a custom column to hold department values
- Mapped this custom column to a refinablestring for using it on Content search web part (CSWP)
- I created a page with CSWP and configured it. I could not see all the values under that refinablestring.
You can follow this step to check on the refinablestring values.
- Create a page with Search web parts (Search box, search results, refinement)
- Configure the refinement web part and add the same refinablestring. You will be able to see all values.
This way you can confirm that the refinablestring has all values.
Below table represents my issue.
Why CSWP is behaving differently?
Those refiner values are being displayed based on the Search results preview items. Thus we see limited values.
What did I do to view required department value?
Please remember, this does not display all the values in CSWP refiner section.
- On Basics tab, change the path that has items with required column value.
Eg: I want to add "Legal" under Refiners tab in CSWP. I know there is a site(https://<sitecoll>/Legalsubsite) with an item with "Legal" value.
That's it !!!!!
Hope you find this content useful.
You are not alone. :)
Here's what happened;
Business requirement:
- Want to display particular department items
Solution:
- Use CSWP and configure the refiners section.
Implementation:
- I have a created a custom column to hold department values
- Mapped this custom column to a refinablestring for using it on Content search web part (CSWP)
- I created a page with CSWP and configured it. I could not see all the values under that refinablestring.
You can follow this step to check on the refinablestring values.
- Create a page with Search web parts (Search box, search results, refinement)
- Configure the refinement web part and add the same refinablestring. You will be able to see all values.
This way you can confirm that the refinablestring has all values.
Below table represents my issue.
| CSWP | Search Refinement WP |
Why CSWP is behaving differently?
Those refiner values are being displayed based on the Search results preview items. Thus we see limited values.
What did I do to view required department value?
Please remember, this does not display all the values in CSWP refiner section.
- On Basics tab, change the path that has items with required column value.
Eg: I want to add "Legal" under Refiners tab in CSWP. I know there is a site(https://<sitecoll>/Legalsubsite) with an item with "Legal" value.
- Goto Refiners tab and look for the required value under refinablestring. (Notice that the search result preview will be refreshed)
- Then add that value
- Go back to Basics tab and change the path to original i.e., https://<sitecoll>
- Click Ok.
Basically, we are narrowing down the search results on preview to see our refinable values.
That's it !!!!!
Hope you find this content useful.
Thursday, July 12, 2018
Generate Delve link dynamically using User's Email ID
Have you ever wondered to have a link on user name that navigates to their Delve page?
Well there's a solution. It works on SharePoint Online.
Requirement: A SharePoint page in SharePoint Online that displays lists users of the current site with their permission levels. End user should have the ability to view the user's Delve page.
Solution: Delve has several Query string properties.
https://delve.office.com/?<properties>
u = user id
v = delve sections (eg: v=work or v=profiledetails)
p = email id
By default, when you navigate to Delve page, it uses the parameter "u". I feel it is bit difficult to fetch user ID (guid) than email ID. Therefore we can use the parameter "p".
Note: You cannot use full email address. It should be user's login name.
Let us assume the user from xyz organization.
User: John doe
Login name: jdoe@xyz.com
Full email: John.Doe@xyz.com
Then the Delve url for John would be
https://delve.office.com/?p=jdoe@xyz.com&v=work
https://delve.office.com/?p=<user's login name>&v=work
Hope you find it useful ! :)
Well there's a solution. It works on SharePoint Online.
Requirement: A SharePoint page in SharePoint Online that displays lists users of the current site with their permission levels. End user should have the ability to view the user's Delve page.
Solution: Delve has several Query string properties.
https://delve.office.com/?<properties>
u = user id
v = delve sections (eg: v=work or v=profiledetails)
p = email id
By default, when you navigate to Delve page, it uses the parameter "u". I feel it is bit difficult to fetch user ID (guid) than email ID. Therefore we can use the parameter "p".
Note: You cannot use full email address. It should be user's login name.
Let us assume the user from xyz organization.
User: John doe
Login name: jdoe@xyz.com
Full email: John.Doe@xyz.com
Then the Delve url for John would be
https://delve.office.com/?p=jdoe@xyz.com&v=work
https://delve.office.com/?p=<user's login name>&v=work
Hope you find it useful ! :)
