Remove Duplicate and/or Orphaned Workflow Menu Items

This is another one of those posts that I just have to blog about because I feel like I will run into this same issue again sometime. I created a workflow using Nintex Workflow Enterprise. There’s an option in the workflow settings to “Enable workflow to start from the item menu” This is very useful because users can manually run this workflow from the item menu when they want to accomplish something. Examples that I have used this for are:

  • End all workflows and delete current item from the list
  • Archive a document

In the case of the Archive Document workflow that I created, which just moves a document to a separate doc library and deletes the original.When I enabled the option to have the custom workflow action in the menu, it somehow created a duplicate… so I now had two options called “Archive Document” when I only needed one.

How could this happen to me!? Of course it happened to me… Okay, so why did this happen?

Nintex listed two potential possibilities:

  1. Duplicate item: The workflow was imported from another environment/site/list multiple times with the menu item enabled.
  2. Orphaned item: The workflow was deleted without first disabling the menu item in Workflow Settings.

The weird part is that neither one of these actually applied to me. The duplication occurred as soon as I published the workflow for the first time. This was an original workflow on it’s own list with no other workflows present.

Let’s fix this thing!

From the research I’ve gathered over at Nintex it seems that there are two main ways to resolve this.

  1. PowerShell (of course!)
  2. SharePoint Designer (of course!)

I actually had a lot of trouble finding this option in SPD.. mainly because my SPD was opening this list in 2010 as opposed to 2013? Uhhhh… This is a new one (will have to figure this one out later) So let’s use the method our best friend would use.. PowerShell

Here is the code from Nintex

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions)

Once you have run the above script, you can target the menu item by its index and delete it by running the below snippet:

$($($(New-Object -TypeName Microsoft.SharePoint.SPSite('http://WebURL')).OpenWeb()).lists['ListTitle'].UserCustomActions[0]).Delete()

I ran into a weird issue with this code. Pulling the custom action wasn’t a problem, it shows the one custom action that I had on this list with a sequence of [0] (and I say one, because I removed one entry from the duplicates by disabling the workflow settings option)

OrphanedItemsPowershell1

The problem came when I tried to the delete it…

OrphanedItemsPowershell2

Null? It’s right there! So since it was the only custom action item showing… I removed the [0] and told it to delete them all (just the one)

OrphanedItemsPowershell

I then reran the original code to see if the custom action would show… nothing showed up! So I checked my list and sure enough it was gone. AHHHHHHHHHHHH Yeah!

 

I hope this helps someone else! Happy Nintexing

Remove Duplicate and/or Orphaned Workflow Menu Items

Formatting an HTML Email with List Items using Nintex “Call web service”

There are a few to many different ways to accomplish this, and I assume as long as you know how to use a Web Service, you can somewhat figure out how to do the same thing as what I’m about to show you even if you don’t own Nintex. I’ve always wanted to be able to do this and had some requirements given to me that required it. It took a lot of research and I combined a few different ways noted by other bloggers. I also had to research and find some specifics for myself. Hopefully this will help someone out.

Call web service

So, what you are going to want to do is…

  • Create a site workflow in Nintex.
  • Add a “Call web service” action
  • In the URL add, “Web URL/_vti_bin/Lists.asmx”
  • For the UN and PW – Use an account that has administrative rights and a non-expiring pw/account
  • Click “Refresh”
  • Web method drop down should’ve populated. Select – “GetListItems”
  • Change the editor mode to “SOAP editor” – I haven’t had much luck with the “SOAP Builder”
  • Copy/Paste this into the SOAP Editor (minus the “1.”)
    1. <?xml version=”1.0″ encoding=”utf-8″?>
      <soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:m=”http://schemas.microsoft.com/sharepoint/soap/”&gt;
      <soap:Header>
      </soap:Header>
      <soap:Body>
      <m:GetListItems>
      <m:listName></m:listName>
      <m:viewName></m:viewName>
      <m:query></m:query>
      <m:viewFields>
      <ViewFields />
      </m:viewFields>
      <m:rowLimit>0</m:rowLimit>
      <m:queryOptions>
      <QueryOptions />
      </m:queryOptions>
      <m:webID></m:webID>
      </m:GetListItems>
      </soap:Body>
      </soap:Envelope>
  • Get the List GUID and View GUID (very important to use the view guid, I’ll explain why later) – add the List GUID to “<m:listName></m:listName>” and the View GUID to “<m:viewName></m:viewName>”
    1. You can get the List GUID by going to https://yoursite/subsite/_layouts/15/mcontent.aspx and copy the link to the list. The GUID will look something like this – {566B8721-4A1F-4824-A74F-63AF34B81D0A}
    2. You can get the View GUID by using an awesome View ID “decryptor” – follow the instructions at this site. – the View ID is in the same format as the List ID
  • Now that we all all of that in place, lets select Run Now at the top and see if we can pull some results.

RunNow

c1

  • Awesome! We have results returned! Now we need to create a Multi-line Variable and name it whatever you want. This is where we are going to store the XML we just asked for. (Hint : In the results portion, copy the XML to Notepad++ (set to XML) so we can reference it later)
  • Now we are going to transform it! The fun part, right!? Go back to the main window for the Call Web Service and at the bottom is a section for Web service output. For “Store result in” click the drop-down and select your newly created Multi-line Variable. In my case it’s “testResult” – Make sure you also select “Force top level XML node” this will surround the results with root node XML.

XMLOutput

So this next part was taken by a Nintex blogger that I reference a lot, http://www.vadimtabakman.com – His site is currently down, so I can’t link directly to the post I referenced, but it’s an amazing source for cool Nintex things you want to do.

  • In the XSL transform section. Add this : (Remove anything in red)
  • <?xml version=”1.0″?>
    <xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; version=”1.0″>
    <xsl:output indent=”no” method=”html”/><xsl:template match=”/” name=”ShowVariables”>
    <html>
    <body>
    <h2>Monthly Draw Donations</h2> Table header, change to whatever you want
    <table border=”1″>
    <tr bgcolor=”#4da6ff”>
    <th>Name</th> Columns for your table, name them to reflect the xsl:value below
    <th>Staff Title</th> Columns for your table, name them to reflect the xsl:value below
    <th>Contribution Option</th> Columns for your table, name them to reflect the xsl:value below (to created)
    <th>Payroll Deduction Option</th>
    <th>Monthly Amount</th>
    <th>US Citizen?</th>
    <th>Authorized?</th>
    <th>Created</th>
    </tr>
    <xsl:for-each select=”//*[name()=’z:row’]”> This will select every row in the VIEW
    <xsl:sort select=”@ows_Created_x0020_Date” order=”descending”/> Sorts list items (needs to be before xsl:if statement)
    <xsl:if test=”@ows_DrawChoice = ‘Monthly'”> xsl:if test = (this is filtering the table data to only show users who selected Monthly as their draw choice)
    <tr>
    <td>
    <xsl:value-of select=”@ows_ReportName”/> The @ows_ comes for the XML we queried and copied to NP++
    </td>
    <td>
    <xsl:value-of select=”@ows_StaffTitle”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ContributionOption”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_DrawChoice”/>
    </td>
    <td>$<xsl:value-of select=”format-number(@ows_DrawDeduction,’#,###.00′)”/></td> Formats to show as $0,000.00
    <td>
    <xsl:value-of select=”@ows_ReportCitizen”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ReportAuthorize”/>
    </td>
    <td>
    <xsl:value-of select=”@ows_ReportCreated”/>
    </td>
    </tr>
    </xsl:if> End of if
    </xsl:for-each> End of for-each
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

final

I spent forever trying to figure out how to format the output to only show data from the last week. I browsed everything I could related to xslt – xsl:choose/xsl:if – I couldn’t find anything! Then it hit me… the web service asks for a view ID – it’s easy to only show a weeks worth of data in SharePoint! I’ll filter the view! So I edit the view and change the filter for the “Created” field to be “is greater than or equal to” “[Today]-7” – AWWWWW YEAH! The view is only showing today – 7 days. But will the HTML table show only the data from the view? You bet it does! The query will only pull what it can see on the view. Damn… that was easy.

Ok back to the tutorial…

  • Now that your view is set up and you have your HTML/XSLT formatted. Let’s add the output variable to a notification. Obviously replace “me” with whomever needs the report. But that’s all you need, just add the variable. You can also make new/separate calls and put them in their own variables. Just add those to the email as well and it will create multiple tables.

notification

Here is an example of the email report with multiple web calls used(sorry I had to block some of the stuff out… probably took me longer to do this than to make dummy data) Looks stupid, but you get the idea! :

c2

Let me know if you have any questions or find a better way to do something!

Formatting an HTML Email with List Items using Nintex “Call web service”

Find out if a field is being used anywhere in your farm

Hello World!

I was recently tasked with a weird one. When trying to enable the “Video and Rich Media” site collection feature, I got this error :

Sorry

This error can occur when you migrate data from one location (that has Video and Rich Media enabled) to another location (that does not have Video and Rich Media enabled). I would assume that this can occur when any site collection feature.

When you enable a site collection feature, you are adding extra content to that site collection (i.e. document libraries, content types, site columns, etc). So when you move a site from one location to another, you bring that extra content with it, because it thinks it needs it in order to function. SharePoint obviously doesn’t like that. It would be nice if SharePoint would throw an error during the migration, letting you know you can import a site because a feature is missing. In our case, it didn’t do this.

 

The Discovery!

I was curious if any other site collection had this issue as well, so instead of trying to go to each HNSC and try to enable Video and Rich Media, I came up with this script to check for it.

foreach($site in Get-SPWebApplication “WEB App URL” | Get-SPSite -Limit All)
{
Echo $site.URL
($site | get-spweb -limit all).fields | ? {$_.ID -eq “2de1df7b-48e1-4c8e-be0f-f00e504b9948”} | ft id, scope
}

This is how the output looks

VaRMPS

If you look at the “Scope” column, if you only see “/ ” – this means that the feature is not being used anywhere in that site collection. If you see a subsite, such as /fst/pd and /TAAR like you see here, this means that both of these sites use it.

 

The Fix!

You must :

  1. export the site fully
  2. delete the site
  3. enable Video and Rich Media at the site collection level
  4. then import the site back

After that, you should be able to freely enable/disable the site collection feature.

Good luck!

Find out if a field is being used anywhere in your farm

Custom Bginfo for SharePoint Admins

So recently I found myself needing to check each of my servers to remember the hardware specs we were using for those environments. I remembered in the past that I used an awesome application that displays this information on the desktop. Bginfo.exe. It’s a must use tool for any administrator, you can customize a lot of things! It also really helps to distinguish between the different environments you are logging into… that way we don’t accidentally apply something to the wrong environment. I know first hand this can happen when you have so many servers open and you’re switching between them.

Now, in this post, I won’t show you how to install/use Bginfo, as there are plenty of guides online. I will show you some custom WMI queries that I use to show some important SharePoint information that I’m looking for, and I hope this will help you.

 

Here is an example of how mine is set up. I’ve had to block out some information

 

Bginfo2Bginfo

Default Bginfo Fields

  • Host Name
  • User Name
  • Boot Time
  • IP Address
  • CPU
  • Memory
  • Free Space

SharePoint 2013 Registry Fields

  • CA URL

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS\CentralAdministrationURL

  • SP Build Version

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15.0\BuildVersion

SharePoint 2013 WMI Queries

When I login to a server, I want to know right away whether these services are running or not. This is an APP server, so Search runs on this one, but AppFabric Cache does not.

  • SPTimerV4

SELECT State FROM Win32_Service Where Name =’SPTimerV4′

  • SPAdminV4

SELECT State FROM Win32_Service Where Name =’SPAdminV4′

  • SPSearch

SELECT State FROM Win32_Service Where Name =’OSearch15′

  • SPSearchHost

SELECT State FROM Win32_Service Where Name =’SPSearchHostController’

  • UPS

SELECT State FROM Win32_Service Where Name =’ProfSvc’

  • W3SVC

SELECT State FROM Win32_Service Where Name =’W3SVC’

 

And there you have it! I also color code each of my different environments

  • Development = Green
  • User Acceptance Testing = Yellow
  • Production = Red

Fairly simple stuff, let me know if you have any other useful ones!

Custom Bginfo for SharePoint Admins

The Greatest Chicken Wings You Never Fried

My first food post!

With the Super Bowl passing us by, I had the opportunity to prep and grill wings for the first time, and let me tell ya… these were incredible! They were crispy, bursting with flavor, and extremely juicy… what a surprise! When I hear home-made chicken wings, all I ever thought about was gross prepackaged Tyson wings in the oven that were slimy and fatty. Not these!

On to the recipe.

Grilled Cajun Chipotle Buffalo Wings

The secret! – Baking Powder – Yes…. you read that correctly, baking powder. There is some science behind using baking powder in your spice blend. I’ll just link my good friends at www.seriouseats.com to explain it:

“Baking powder raises pH and dehydrates the wings’ skin so that it crisps in the oven just like they would if they were fried.”

Here is my spice blend:

*Because of the baking powder, your blend will look pink. No worries! The wings won’t turn out like that!*

  • 1 tablespoons baking powder
  • 1 teaspoon paprika
  • 1 teaspoon garlic powder
  • 1/2 teaspoon onion powder
  • 1/2 teaspoon dried thyme
  • 1/4 teaspoon dried oregano
  • 1/4 teaspoon cumin
  • 1 teaspoon kosher salt
  • 1/4 teaspoon freshly ground black pepper
  • 1 teaspoon cayenne pepper
  • 1 teaspoon chipotle powder
  • 1 teaspoon chili powder
  • 3 pounds chicken wings, cut into drumettes and flats

Here is the Chipotle Buffalo Sauce

  • 1 cup of Texas Pete hot sauce (or any pepper hot sauce)
  • ½ cup of unsalted butter
  • 1 ½ teaspoon of white (distilled) vinegar
  • ½ teaspoon of Worcestershire sauce
  • ½ teaspoon of cayenne pepper
  • ¼ teaspoon of garlic powder
  • 1 teaspoon of salt
  • 1 7oz can of chipotle adabo (the pureed salsa one, you can get it in the International isle at publix)

 

Prep the wings the night before! Pat the wings dry with a paper towel. Toss the wings in the spice blend and put them on a wire-rack in your fridge for at least 10 hours

 

wings2

Baking Method: Preheat the oven to 450. You need a wire-rack for this one! Otherwise they won’t have proper air circulation around them. The wings will get greasy and soggy (that’s a no-no!). Cook them skin up for 20 minutes, flip them over and cook for an additional 15-20 minutes.

Grilling Method: Gill them over medium flame. Char them up! Make sure to oil your grill rack. It took about 8-10 minutes per side. Start with the skin up.

Just look at them! Amazing! Teaser shot of the sauce at the top right. Enjoy! Let me know below if you make them!

wings

The Greatest Chicken Wings You Never Fried

SharePoint 2013 – January 2016 CU Issues

Heeeeeeeellllllllloooooooooooooo SharePoint world! What a fun month it has been! It’s hard to convey sarcasm through the internet, but it sure as hell has been an interesting start to 2016 all thanks to Security Patch MS16-004 (KB3124585). I assume most of you know, it breaks all SharePoint lists. Microsoft… How could you!? Installing this security patch forces you to install the January 2016 CU, which is starting to show it’s own bag of bugs. This is a perfect example of why you should never install a new CU just because it comes out. Think of it as a BIOS upgrade. There is no need unless you need to fix something.

Security Patch MS16-004 (KB3124585)

Regressions

  • Breaks SharePoint Lists – Show “TypeError”

Fixes

 

SharePoint 2013 – January 2016 CU

Possible Regressions

  • Issues with Excel Services causing app pool to crash
    • Only fix seen is to remove Excel Services
    • *UPDATE* – Run Initialize-SPResourceSecurity on all of your servers, this fixes this issue – Thanks Stacy!
  • Managed Metadata connection/permissions issue
    • Running Initialize-SPResourceSecurity fixed this issue
  • Issues with deleting Site collections from inside Central Admin – SharePoint redirects user back to Central Admin home screen when trying to change the web application.
    • Workaround is to use powershell
    • *UPDATE* – Don’t use Chrome! Doh!

KB 3114508

Regressions

  • None that I know of

 

So far that’s it…. If you see anything else please write in the comments below and let me know!

 

SharePoint 2013 – January 2016 CU Issues

Wrong domain showing up in User Profile Services

Configure NetBIOS Domain for UPS

I’m sure, like me, a lot of you out there have a company with a long FQDN. For example, instead of something easy (chaddtalks.com) they want to use something crazy like (us.firm.inc.chaddtalks.com) Have you noticed when running a User Profile Sync it’s pulling in the wrong domain? Maybe US\User or FIRM\User? You would like it to show your actual domain! chaddtalks\User? Welp… here’s how!

  1. Open SharePoint Shell
  2. Get-SPServiceApplication
    • Copy the Id of the User Profile Sync
  3. Set variable
    • $var = Get-SPServiceApplication -Identity <paste Id from step 2>
  4. Verify variable
    • $var
  5. See if NetBIOS is set to True or False
    • $var.NetBIOSDomainNamesEnabled
  6. netbios
    • If False run
      • $var.NetBIOSDomainNamesEnabled = “True”
  7. Verify that the variable changed
    • $var.NetBIOSDomainNamesEnabled
  8. UPDATE THE VARIABLE! Super Duper Important
    • $var.update()
  9. Verify the variable is still set to “True”

 

You’re all set! Now you can run a sync and get the correct domain name for your users.

Wrong domain showing up in User Profile Services