Showing posts with label SharePoint Online. Show all posts
Showing posts with label SharePoint Online. Show all posts

Thursday, December 2, 2021

SharePoint Online: Temporary fix for error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'

 Hello All,


You will be shocked to see the error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'  after using Connect-PnPOnline cmdlet for SharePoint Online.

There is a temporary solution. 

Solution: Downgrade your PnP module to version 3.20.2004.0

Here's what happened to me.

I got new laptop and setting up my Dev environment. 

- Installed PnP module (latest version)

- Tried connecting SharePoint Online using Connect-PnPOnline

- Got the error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'

- Official solution is to ask admin to approve "PnP Management Shell" app

Seriously !!! Come on. 

As a SharePoint developer, I dont want to request Admins for these things.

PnP was very powerful tool for developers but now ?

Few experts were providing the solution to use Connect-PnPOnline -Url <siteurl> -Interactive . It didn't help.

On the PnP github, someone said that he downgraded the PnP version. 

I tried and it worked. 

Temporary solution

UnInstall-Module -Name "PnP.PowerShell"

Install-Module -Name SharePointPnPPowerShellOnline -RequiredVersion 3.20.2004.0

Sharing is caring. 


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

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.

Restricted Ports
80
12345
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 )

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.
CSWPSearch 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 ! :)

Wednesday, May 17, 2017

How to setup Azure web app ?

Brief Intro:
The Web Apps feature in Azure App Service lets developers rapidly build, deploy, and manage powerful websites and web apps. Build standards-based web apps and APIs using .NET, Node.js, PHP, Python, and Java. Deliver both web and mobile apps for employees or customers using a single back end. Securely deliver APIs that enable additional apps and devices.

How do I use it?
I use it for my SharePoint Add-ins (Provider Hosted App) for SharePoint Online.

Prerequisites:
- Azure Account

Steps:
1. Login to https://portal.azure.com
2. Navigate to App Services section

3. Click +Add button

4. Select "Web App" or "Web App + SQL" based on your requirement

5. Click Create
6. Fill out the form and click Create
That's it !!!!!

You may have to look at this blog to know "How to deploy web sites to existing Azure Web App using Visual Studio ?"
URL: http://mahedevelopment.blogspot.com/2017/05/how-to-deploy-web-sites-to-existing.html


Thursday, December 22, 2016

SharePoint Online Microsoft's Funny Errors on bad deployment


1. This screenshot I have taken from List's display form on 22-Dec-2016. What are these new irrelevant commands for list's display form? Everything is disabled including Edit Item link  !!!!! lol



2. This screenshot I have taken after clicking edit page from List's display form on 22-Dec-2016. Why do we need two insert tabs on edit page? :D

SharePoint Online: JS Link not working

What is it?
You might be wondered why your JS link stopped working today (22-Dec-2016). It was working well till yesterday.
Maybe Microsoft broke with their usual untested code. Uuh!
This is very bad. Microsoft breaks SharePoint Online at least >3 times in a month.
Please Microsoft, we (IT) are getting blame from every business.
My assumption is, Microsoft does not do Regression testing well.

Coming to the error, Here's what happens;
I am styling the list view using JS link. Till yesterday it was working. Today it stopped.

Why?
It's because, it is looking for the resource on https://static.sharepointonline.com
Whaaaaaat !!!!!!!!!!

eg: https://static.sharepointonline.com/bld/_layouts/15/16.0.6008.1206/sites/devsite/siteassets/js/structuregd.js

When I paste the full URL on JS Link text box, it truncates the domain part upon saving.
Eg: https://devtenant.sharepoint.com/sites/devsite/siteassets/js/structuregd.js is being saved as /sites/devsite/siteassets/js/structuregd.js

Till yesterday it used to save the complete URL.

Warning: Do not edit the existing web parts that uses JS Link. Create a new page for testing.

I have created the Microsoft support ticket and awaiting their response. Will update this post once I get it.

===================================================================
Update from Microsoft Support:
"Product team might be working on SPO environment like deploying new features. That may have caused the issue. we will let product team know about this issue."
Workaround:
Use ~site token while referencing the JS file.
Eg: ~site/SiteAssets/js/structuregd.js

Wednesday, October 19, 2016

SharePoint Online team news

Team news for SharePoint Online is a new features within Office 365 team sites. Rollout is planned for First Release customers through the month of October 2016 with worldwide rollout expected to complete by the end of November 2016.


What does this mean ?
Team news will allow you to quickly create beautiful posts that are showcased on your team site home page – status updates, trip reports, or even just a highlight of an important document with some additional context provided to the team. Team news will be appear in both the SharePoint Online web experience for team sites and also the native SharePoint mobile app for iOS, making it simple for your team members to stay up-to-date with what's important for the team and stakeholders anytime and anywhere. Additionally, team news will be added to additional platforms in the future.

Click here to learn more 

Thursday, September 1, 2016

Microsoft Update: New capabilities in SharePoint Online team sites including integration with Office 365 Groups

Today Microsoft begin bringing SharePoint team sites to Office 365 Groups. Both existing and new groups will now get a SharePoint site. Within a group’s team site, this roll out brings a new home page, featuring the Quick links web part for showcasing links to important team resources, and the Activity web part for showing recently active content. It, too, brings modern pages. These are responsive and powerful page authoring and consumption experiences in Office 365. Modern pages will come as a part of the team site within Office 365 Groups and will be available to all existing team sites, even if they are not associated. Last, Microsoft will begin to increase the SharePoint Online site collection limit to 25TB – up from 1TB.
How does this affect me?
Modern SharePoint Online team sites will first come to existing Office 365 Groups. It will start rolling out to First Release customers early September 2016. This will include the new home page, publishing pages, quick links, activity—inclusive of modern lists and libraries. All classic SharePoint functionality is available, too – you can access it from the Site Contents page and within Site Settings. The new 25 TB site collection limit will begin rolling out next week and is expected to be rolled out to all Office 365 customers worldwide within one month.
What do I need to do to prepare for this change?
Please click Additional Information to learn more.
Additional information

Wednesday, July 20, 2016

SharePoint Online MobileExcelWebAccess Feature - Unable to create site using custom template

I am sure you would have got this error suddenly while creating sites using custom template in SharePoint Online.
Error: MobileExcelWebAccess Feature e995e28b-9ba8-4668-9933-cf5c146d7a9f Not activated



Microsoft is unsure about the issue but there is a fix. 

Prerequisites:
- You should be an Administrator 
- Windows PowerShell
- SharePoint Online Management Shell
- SharePoint Online Client Components SDK (Download: http://www.microsoft.com/en-us/download/details.aspx?id=42038)

Steps: 
1. Open Windows PowerShell in Administrator mode and execute the script
         Set-ExecutionPolicy -ExecutionPolicy Unrestricted

2. Open SharePoint Online Management Shell in Administrator mode and execute the script

$clientDll = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$runtimeDll = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")


$url = "https://<your site collection url>"


$cred = get-credential

$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.username, $cred.password) 
$clientContext.Credentials = $credentials 

if (!$clientContext.ServerObjectIsNull.Value) 
{ 
    Write-Host "Connected to SharePoint site: '$Url'" -ForegroundColor Green 
}

$clientContext.Site.Features.Add('e995e28b-9ba8-4668-9933-cf5c146d7a9f',$true,[Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)

$clientContext.ExecuteQuery()

Note: Do not forget to replace the $url with your site collection url

Alternatively, you shall save the above #2 script in .ps1 file and execute it.
To execute the .ps1 in SharePoint Online Management shell;
- Open SharePoint Online Management Shell in Administrator mode
- Go to the directory where you have .ps1 file
- Type .\<file name>
- A prompt will be displayed that asks your credential (Administrator)

That's it !!!!!

Thursday, July 14, 2016

SharePoint 2013 / SharePoint Online Create multiple Pages library

My requirement was to have separate Pages library for categories. 
So, I took the Pages library template and tried to create a library using the template. SharePoint throws an error. 

I contacted Microsoft Support team and they confirmed that a site cannot have more than one Pages library. 

Today I accidentally found a way to accomplish that. This post lead me to this. 

We can select the Page template while creating Document library. 

SharePoint 2013 / SharePoint Online Create OneNote document library

SharePoint provides very easy way to accomplish many business requirements. But we, developers, always think advanced solution that takes lots of effort.
One of the example is Document library for OneNote.

I started thinking to have content type with template and etc.,

And found out the easy way.

1. Click Add an app

2. Choose Document Library 
3. Click Advanced Options

4. Select Document Template as "Microsoft OneNote 2010 Notebook"
5. Click Create.

That's it !!!!!



Friday, July 8, 2016

SharePoint Library settings is missing in new look and feel

I was introduced to new look and feel in SharePoint Online (SharePoint 2013 version) for document library on a Team site. At first I was like "Wow !" then it turned me down.

I wanted to go to Library Settings. I thought it should be under the Ellipsis (3 dots) button. When I clicked on it, I was shocked. Because;
Just "Alert me" !!!!!!!! Don't Panic !

After spending lot of time, then I found it !
Yes, they moved it to the Gear icon on topmost ribbon. This is meaningless (for now)!



Also I noticed, the gear icon menu is dynamic, based on the page we are in. 
Hope it is useful to someone.

Tags: SharePoint Online, SharePoint 2013, library settings menu is missing, 

Tuesday, April 19, 2016

SharePoint 2013 CSS not working in custom html page layouts

I have been customizing a SharePoint 2013 site, not in SharePoint 2010 way where we just copy paste the aspx file and edit it. I use Design Manager feature for branding the Master pages and Page layouts.















Once we create a page layout using Design Manager, a HTML file will be created. Then we open that HTML file using SharePoint Designer 2013 and edit it.

I faced an issue on editing the HTML page layout file. I wanted to hide the page title but failed !!!!!
This is what I did. I found the ID of the HTML tag and applied CSS inside the HTML page layout file.
After refreshing, I still see the page title. Because SharePoint 2013 appends CDATA where browsers ignore while rendering.

<style type="text/css">//<![CDATA[
.ms-long
{
   width: 100%;
}
//]]></style>

I tried many things and gave up. Then decided to create a page layout in SP 2010 way.
But lastly I wanted to try couple more times and found the solution.

This article helped me. https://msdn.microsoft.com/en-us/library/jj822367.aspx

In SharePoint 2013, the branding is completely different. We need to use the Design Manager Snippets. Therefore the above CSS should be rewritten as;

<!-- MS: <style type="text/css">-->
<!--
.ms-long
{
   width: 100%;
}
-->
<!-- ME: </style>-->

It worked !!!!! Happy day :)

Tuesday, February 23, 2016

SharePoint 2013 / SharePoint Online Search on custom columns

Requirement:
SharePoint Online search results should display results even if user typed keyword matches custom column value.

My Action:
I told business users, "Yes, we can do it". All were happy. Once I implemented the solution, I could not see the results. :( Very bad.

What I tried:
- I went to Site settings, under Site Collection Administration -> Search Schema
- I searched for managed properties which are created by SharePoint.
  ["SharePoint creates one when we create a column" - I believe so]
- In my case, I was looking for "Document Category" and it showed me  "DocumentCategoryOWSTXT"
- I edited that property and mapped my custom column
- Since it is SharePoint Online, I waited for one day to see the results.
- Next day i tried search items but no luck. Surprised !

I have went with so many alternate approaches but failed.

The Fix:
Suddenly I got an idea and i tried it. It Worked !!!!! :) Here's it;
1. Create new managed property and map the custom column
   - Go to Root level site settings
   - Look for "Search Schema" under Site Collection Administration and click it
   - Create a new managed property for the column you want to map it
      [In my case, I created "DocumentCategoryCustom" and selected the checkboxes of Searchable,     Queryable and Retrievable]
   - Map the custom column
     [In my case, I want to map the sub site's custom column "DocumentCategory". The column name was showing as "ows_DocumentCategory" in root level. I mapped it.]

2. Reindex Site
    - Go to Site settings
    - Look for "Search and Offline Availability" under Search
    - Click on Reindex Site

That's it !!!!!

[Later I came to know that this is a known issue and Microsoft's backend team is working on it. ]