Monday, February 22, 2021

Hello 2021! Amazing that it's been this long since I shared back...

Just a quick tip for today. I've been working with the PnP Modern Search v4 web parts and really like them - mainly to help tailor a search experience similar to what my customer has today with SP2010, but without me having to write code for it. I might end up tweaking things a bit (like, changing ".aspx" in the refiner to "Pages", ".docx" to "Word Document", etc) but it's giving me the functionality required. Do check them out here:

Introduction - PnP Modern Search (v4) (microsoft-search.github.io)

One of the things my customer asked for was an ability to show results from the signed in employee's location. One thought was to create a separate Search Results web part that would include the location in the search string - so if I did a search for "cafeteria menu" I'll get the menu for my work location first, vs the one that was most recently updated from the other work locations. Still working on a way to bake in my location into search relevancy, but for now, this worked. In the Query Template of the PnP Search Results web part, I'm using this:

{searchTerms} and {User.PreferredLocation}

where in my case, PreferredLocation is a User Profile property with the value for the user's preferred location. That's the syntax to use for any of the user profile properties.

Alright world, let's hope it isn't another three years til my next post! All the best!


Tuesday, July 24, 2018

Microsoft Teams, Visual Studio & PowerShell: Module was not loaded because no valid module file was found in any module directory

Hello world!


I've been working on a small utility to programmatically create new Microsoft Teams sites?teams?rooms?pages?  whatever they're called.  The idea is to accept some parameters from the user, if needed route the request for approval, then create the new site.


Currently, the only programmatic method to create a new Team is with PowerShell.  Works great interactively, so the next step was to see if I could create the new Team using PowerShell invoked from code.  Yeah, not elegant, but so far that's the only option.


I started off creating a new VS Windows solution with the big ol button on there to just run some code - and no dice.  If I ran the same script interactively it worked great, but not from within Visual Studio.  The error received was Module MicrosoftTeams was not loaded because no valid module file was found in any module directory.


The culprit: 32 bit instead of 64 bit.


When I switched VS from 32 bit to 64 bit, no more error, and my Team created as expected.

Monday, March 19, 2018

SP json conditional formatting

Hi world!  Yes it has been a while indeed...but finally something to give back!

My customer asked to have SharePoint Online views formatted such that the font color for certain rows would be different based on the Status field value for the list item.  Since we're using SPO I did not want to go the custom column formatter route, and I found a reference for using JSON for column formatting - but no great examples.

The only wrinkle I found is this is done at the field level - so wherever this field is used in a list, it will include this formatting.  Fortunately not an issue in my case, but you might have a case where you want the field to retain its default formatting.

{
    "elmType": "div",
    "txtContent": "@currentField",
    "style": {
       "color": {
          "operator": "?",
          "operands": [
             {
                "operator": "==",
                "operands": [
                   "[$processStatus]",
                   "Inactive"
                ]
             },
             "#a9a9a9",
             ""
          ]
       }
    }
 }

My status field is processStatus (case matters).  And in my case I want to change the color to a dark gray, if the status is equal to 'Inactive'. 

The result:


Success!

Monday, September 12, 2016

SharePoint add-ins tenant permissions and appinv.aspx

Having issues deploying your tenant scoped SharePoint add-in (though I confess I still call them apps)?  You've pasted the XML for your add-in on the appinv.aspx page and you get a message back that you have to be a tenant admin?  But wait you are logged on as the tenant admin!

Microsoft recently made a change that any apps that require tenant permissions must use the tenant admin site itself for the AppInv.aspx - so navigate to https://mytenant-admin.sharepoint.com/_layouts/15/appinv.aspx and try out the same steps - it'll work just fine!

Makes sense I guess that in order to deploy a tenant scoped add-in I really should be a tenant admin... I haven't tried to verify whether I need to be a global admin or just a SharePoint admin, but I suspect both would work fine.

Tuesday, August 16, 2016

SharePoint Designer, Workflows, local cache

Hi world, been a long time!  I'm still SharePointing, been having fun with client side rendering and JSOM.  Post on that coming soon, promise!

In the meantime, here's a quick one.  Admit it, you still use Designer.  It's still a handy tool especially for workflows.  I had put together a workflow for one of my customers, it's been working just fine.  Occasionally, though, when I went to edit it, I would get an error generating local caches.  There's some recommendations on how to clear out the local cache & try again, but that didn't seem to help me.  I tried on multiple PCs and VMs and finally got one working, then three months later promptly forgot which combo actually worked...so time for that root cause.

What did help?  Run as Administrator.  Yep, the issue wasn't in pulling down the content for the caches, but getting that content into the local file system.  I'm logged on with a local admin account on my dev VM, but even so that didn't help.  So, with your nifty Designer program icon, hit Ctrl + Shift then click, accept the prompt to run as Admin, and edit those workflows away.

See you soon!  The big teaser is, re-running a workflow when an item is edited on O365.  It can be done.

Wednesday, March 18, 2015

Visual Studio, MVC and a proxy server

Hello world,

I'm preparing a talk for this weekend on MVC development with SharePoint Online - I'll post the deck once ready!

In preparing for the demos, when I try to connect an on-premises Provider Hosted App to my SPO tenant, I'm prompted to enter in my tenant credentials, SharePoint is Working On It... then, I get an error in Visual Studio on the clientContext.ExecuteQuery(), System.Net.Exception, Unable to connect to the remote server.

The issue - I'm behind a corporate proxy server.  The fix - tell .Net about it!  Easy enough to do, just add the following to the web.config file for the MVC app:
 
<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>

Hit F5 and you'll be good to go!

Friday, October 03, 2014

Visio Services - The server failed to process the request

Another day, another interesting SharePoint error!  I finally got around to building out a Visio dashboard for my model office environment.  We've got a lot of servers out there and it's about time to get a handle on overall health and performance. 

The dashboard worked great until I let the team try it out - two folks reported back that the page was showing an error, "the server failed to process the request".  ULS showed a related error, at Microsoft.SharePoint.WebPartPages.Utility.SetThreadCulture - not totally obvious!

Searching out there turned up a blog post by Robert Seso of a similar problem on SharePoint 2010 - different ULS log entries, though.  I tried out the fix he suggested to solve his issue - grant a permission to the service account a used by Visio Services - not the SCOM service account or data reader account, but the service account configured for Visio Services in SP2013.  Here's the PowerShell to run:

$webapp = get-spwebapplication("http://mywebapp.myserver.com")
$webapp.GrantAccessToProcessIdentity("mydomain\sp_visiosvc")

Go back to your page, refresh, and so far so good.

http://www.robertseso.com/2012/02/troubleshooting-workflow-visualization.html

More clarification!  So far not so good.  I think the real issue here was on how I had set up the data source.  Initially, I had created a site collection, pointed the ODC file at that URL, then all was good.  I then decided to make things nicer and go with a host named site collection, which in & of itself was not the problem, the problem was, I used the original ODC file without updating it for the new HNSC.  I recreated the ODC file in the HNSC and recreated the Visio drawing to use this ODC file & it's been running fine since.