Haaron Gonzalez – Blog in English Rotating Header Image

SharePoint;

Make your SharePoint farm aware of pending patches to apply

Good day, I will leave this little but wonderful trick here in my blog.

Whenever you experience the following message while applying patches in SharePoint by running the following command:

PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

And then error happens telling you:

The applicationcontent command is invalid or a failure has been ncountered. The server farm will not work with missing installs. Add “-cmd installcheck -noinstallcheck” to the command-line to ignore this warning.

Pending updates

Please make sure to run the following PowerShell command on each server in the farm, before running the PSConfig command again:

Get-SPProduct -local

This way your farm will be truly aware of the patches are pending to apply

 

Best Practices for Nintex Forms Development

Good day people, its long time without posting here. Starting today I promise to myself start doing it more often. Looking at my backups found some conference notes that I took while attending Nintex conference few years ago. Wanted to share these notes related to Nintex Forms

Best Practices

  1. Ensure you know what the customer wants to do without a form or a workflow design, just identify what they need from the business perspective, don’t jump into Nintex right away, try to understand the business outcome first

Form Design
Don’t go crazy with form design, first make sure you capture the fields that are important and make things work as expected

Follow this process:

  • Perform a basic form design
  • Make things work in the form
  • Ask for feedback
  • Make final layout touches

Naming Controls

  • Name all form controls
  • Name needs to be unique
  • Make the name relative to the information that it holds
    • CAL_LineTotal
    • RPT_Price (unbound controls)
    • SUM_TotalAmount
    • TXT_Product

Binding Controls

  • Bind controls when applicable
  • Do not bind 2 controls to the same SharePoint column

Associate controls & labels

  • Add name to labels
    • LBL_Name
    • LblName
  • Associate label to control

Data Validation

  • Manage validations at SharePoint list
  • Use the control settings
  • Use control rules
  • You can hide and show labels based on rules in order to have validations while you type data in the form

Panels

  • Allow us to group controls together
  • Provides a better vertical experience
  • You can also apply rules to panel so you can disable a whole section
  • Makes moving easier

Simple & Advance Rules

  • Choosing what works best
  • Create one “Complex Rule” or many “Simple” rules
  • Try to keep it simple
  • Rule stops working, don’t know why?

Form Redirect on Submission

  • Providing a better experience
  • Send people somewhere meaningful
  • Use the redirect form to point to another form
  • You can relate multiple forms as part of a process using the redirect option

Get the members of specific Office 365 role

Good day, this time I was asked to retrieve who the Company Administrators and SharePoint Service Administrators are from customer tenant.  The following is the steps I’ve used to deliver the requested Info:

  • I downloaded the Microsoft Online Service Sign-In Assistant from the following URL https://go.microsoft.com/fwlink/p/?LinkId=286152, proceeded to install
  • Install the Azure Active Directory for Windows PowerShell Module, as an Administrator loaded the PowerShell console and executed the Install-Module MSOnline command, specified yes, “Y” two times, first for NuGet and then for Untrusted Repository
  • Inside the PowerShell session, executed the following PowerShell commands:
  1. Import-Module MSOnline
  2. Connect-MsolService this command loaded an authentication window, you need to provide credentials
  3. Get-MsolRole, this command will list all the Office 365 roles, make sure you identify the one you need and copy the Object ID value
  4. Get-MsolRoleMember -RoleObjectId “rol ID” this command will display who the members of the role are

 

 

Reference:

https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell

 

Old school SharePoint tip

Good day colleagues, while supporting SharePoint 2010 custom application, suddenly new requirement out of the blue came up.  They said, stakeholder says that it will be great if this form can be accessed in a kiosk inside the plant, can you make it happen? Oh, and please remove the navigation stuff like the left and top links so kiosk will display only the form, no navigation or any other thing that may confuse people.

As a developer, you will think, not a problem I can use some CSS to hide some classes. But there is another simple way to get around about this, just add the:

http://yoursiteURL/Pages/DTCode.aspx?IsDlg=1 parameter in the query string of your URL and that will remove top navigation, top ribbon section, quick launch and will leave the whole page just for your web part.

 

Unsupported expression in good old InfoPath

Even though Is been announced that InfoPath is deprecated, but supported until April 2023 you can read more here  the reality is that there is a significant amount of customers that still rely on the InfoPath form based solutions for dealing with data entry challenges in the organization on a daily basis. As a consultant, I currently support multiple clients on InfoPath Form related issues.

Today I want to talk about a recent discovery and of course share the solution.

This is a custom list with an InfoPath list form used for storing OA’s (Operational Activities) assignment information, of course, this list has a bunch of fields for specifying the type, who is assigned to, location and most importantly how many hours per week (52 weeks) during the year each OA will take.

Operational Activities InfoPath based Form

Notice the Duration in Hours field, basically this field is automatically calculated based on the number of hours specified on each week. How many weeks do we have during a year? 52 weeks. So, you can guess that the formula to calculate the duration field will be something like this:

Formula for counting the hours on all the week’s during the year

 

 

 

But as soon you want to publish the Design Checker throws an error stating an Unsupported expression error.

Unsupported Expression Issue in InfoPath

After some research found out that the problem was more related to the size of the expression. So, be careful of creating huge long calculation expressions. What I did was to create 4 fields that represent each Quarter and add the formula to calculate the weeks for Q1, Q2, Q3 and Q4. Then I modified the formula in the Duration field to use the 4 quarter fields, something like: Q1+Q2+Q3+Q4.

Bottom line, you never stop learning a technology, even though is a deprecated one.

Prevent Document Download in SharePoint Online

Good day colleagues, wanted to share with you all how to configure a document library that doesn’t allow users to download his content. In our scenario here is to expose a document library to a group of people inside the company, but the requirement was that these people shouldn’t be able to download the content, this is just a document library for content consumption, no collaboration at all and of course read only for visitors.

It is simple to achieve the desired outcome because there is a permission already in the system that allows us exactly what we need, but it has some limitations that you should know first before you commit to deliver what business ask us to do.

As general understanding please read the following descriptions about the permissions already available in SharePoint, please read to the end because you will see what permissions makes sense for us to use.

  • Full Control – Has full control.
  • Design – Can view, add, update, delete, approve, and customize.
  • Edit – Can add, edit and delete lists; can view, add, update and delete list items and documents.
  • Contribute – Can view, add, update, and delete list items and documents.
  • Read – Can view pages and list items and download documents.
  • View Only – Can view pages, list items, and documents. Document types with server-side file handlers can be viewed in the browser but not downloaded.

Yes, the View Only permission gives us the required behavior. In other words, this permission allows us to visualize documents inside a browser (of course with the help of Office Web Apps or Office Online Server) and documents cannot be downloaded. The question here is: What are the documents we can visualize in the browser using Office Online Server? The answer is Only Office Documents and what Office Documents are we talking about? Word, PowerPoint, Excel.

This means that:

PDF or any other file type that is not an office document can be downloaded ☹

Let’s explore how to configure this:

  1. Create a security group that has the View Only permission
  2. Create and configure a document library
  3. Test with another user that the download is not possible

Let’s see it in action here in this video, since now, thanks for reading, thanks for watching, thanks for sharing.

Just use a Office 365 based credential when deploying programatically

So all people happy and kind of impress with Office 365 Pattern & Practices components, especially the ones that are related to Office 365, is so much easier and simpler the provision things up to SharePoint Online. Recently had to deploy some assets into SharePoint Online, I did use Office 365 PnP as our deployment approach. Everything work just fine in our Office 365 Dev environment but as soon I got to customer tenant our deployment console app didn’t work as expected.

First I notice that customer had ADFS set up and the code when trying to authenticate was throwing the following exception:

Unhandled Exception: Microsoft.SharePoint.Client.IdcrlException: Unable to get ticket due to unknown error.
at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String securityXml, String serviceTarget, String servicePolicy)
   at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String username, String password, String serviceTarget, String servicePolicy)
   at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticationCookie(Uri url, String username, SecureString password, Boolean alwaysThrowOnFailure, EventHandler`1 executingWebRequest)
   at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(Uri url, Boolean refresh, Boolean alwaysThrowOnFailure)
   at Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(ClientRuntimeContext context, HttpWebRequest request)
   at Microsoft.SharePoint.Client.SPWebRequestExecutor.GetRequestStream()
   at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
   at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext,Int32 retryCount, Int32 delay)
   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay)
   at BrandingCAN.Program.Main(String[] args) in projectpath\Program.cs:line 41

Did some research and perform several recommendations, but unfortunately didn’t work at all. So, at this moment I still don’t understand what to do to make my console app to authenticate to O365 with ADFS set up and account. But, I did manage to solve the issue just using an Office 365 based credential instead of an ADFS based credential, and that’s what I wanted to share here.

Whenever you deploying something programmatically to O365, please use O365 based credentials like “accountname@company.onmicrosoft.com” and Office 365 PnP and all SharePoint Client APIs will perform as expected.

 

Formulas to get the first and last row on a repeating table in InfoPath

You know, you wake up knowing that is going to be a wonderful day working for a customer with the software products you love. During today on-site support session, you found out that is needed to write some good old XPath formulas on an InfoPath form.

There is a repeating table with the columns necessarily to describe travel information like Departure Date, Return Date, City, you named and the requirement was to expose the initial Departure Date and the last Return Date of the entire trip, so, what do we mean with entire trip? I maybe start a trip from San Diego to Mexico City, and then another trip from Mexico City to Seattle and then from Seattle to Las Vegas. Clearly, the Departure Date and Return Date are not associated with just one row “trip” in the repeating table because I have at least more than one row for describing all the trips.

The data structure of the repeating table is:

 

 

structure

So, here are the formulas to get the first and last row on a repeating table.

../my:TravelInfo/my:TravelInformation[count(preceding-sibling::my:TravelInformation) = 0]/my:DepartureDate

../my:TravelInfo/my:TravelInformation[count(following-sibling::my:TravelInformation) = 0]/my:ReturnDate

Fortunately, the approach work as a charm. No C# code saved the day today. Pure old good XPath did it. InfoPath, you are definitely the sunshine of my love, especially now that you will be supported until 2026 baby.

 

SharePoint pushed to its limits

championsHave you been interested in knowing how intranets get together? Or what practices teams follows in order to design/build/deploy and support an enterprise intranet? I did had the question too, and one of the resources I have been following for a couple of years now is the Nielsen Normal Group Intranet Design Award. This is a competition conducted by the Nielsen Norman Group called annual intranet design to identify the world’s 10 best intranets.

In this report you can see very interesting topics that will definitely give a broader idea on what it takes to build and deploy a top notch intranet. As a SharePoint consultant this also makes sense to review because you can see some real world SharePoint implementations, ideas, trends, features and approaches that maybe you didn’t know were possible.

Be aware that the report is not free, you need to pay for a licensed copy.

Congrats to BrightStarr for participating and winning this year!

 

A quick tale from the SharePoint support trenches

Basically, the customer had a workflow, build in SharePoint Designer 2010 that will use some of the out of the box Actions like the Pause for Duration and Send Email. The issue was that once the workflow paused for a minute it wasn’t able to resume the work, leaving the workflow always running “In Progress”. Doing some research found KB2674684 SharePoint 2010: Workflow failed to run after pause and according to the description made me remember my good old ASP.NET developer days.

The bottom line is that SharePoint on premise is ultimately a Microsoft ASP.NET solution that works with multiple windows services and related Microsoft technologies/servers. From the web perspective Web Server Controls, Web User Controls, HTTP Handlers, Web Services, AJAX, ASPX pages, assemblies, web.config, page directives and so on are just pieces that work together to deliver a page that end users to consume.

Turns out that if you have the Workflow Timer Service started on a server that is running as an Application Server role “App” and you don’t have the SharePoint Foundation Web Application service started “basically the WFE role”, workflows will fail rehydrating the workflow when resume from a pause action, the reason why?, is because in order to rehydrate a paused workflow SharePoint needs to read some settings from the running web application web.config file, but because we have only the “App” role and not the “App/WFE” role running, it fails loading from the required Web Application the web.config file, because THERE IS NO web.config to load for that particular web application in the App server. The App Server without the SharePoint Foundation Web Application Service started only has available the Central Administration web application, not those additional web applications that WFE have available in IIS as a web site.

According to the article there are three methods for solving this issue:

  • Method 1: Locate one Web Front End server, which has Web Application service running, run the following PowerShell command to copy workflow-related configuration from the web.config to the configuration database so it will be available from every server in the Farm.

$webapp = Get-SPWebApplication -identity http://<web app name>

$webapp.UpdateWorkflowConfigurationSetttings()

  • Method 2: Start the Web Application Service on all servers that have the Workflow Timer Service is running.
  • Method 3: Disable the Workflow Timer Service on servers that are not running the Web Application service.

I decided to use Method 3 because we have dedicated App server and dedicated WFE server.

By the way, if you have Nintex Workflow installed in your farm, what just explain also apply. Nintex Workflow should run only n WFE servers, so make sure you Workflow Timer Service is stopped on all app servers in your farm.

Thanks for reading!