SharePoint | @SPJeff

Manually Run “Pause Until” SharePoint Designer Workflows

May 15, 2012 in Uncategorized

Recently I needed to simulate a future lapse in time in order to manually trigger the “Pause Until” SharePoint Designer function.  In the example below, the SharePoint server is a local DEV virtual machine running in Oracle VirtualBox.  That means it receives time from the parent machine.

 

Action Steps

  1. Move VM host clock forward 1 day (24hours)
  2. Move VM guest clock forward 1 day (24 hours)
  3. Run the Powershell command “Get-SPTimerJob | ? {$_.name –like ‘*workf*’} | Start-SPTimerJob

 

What the above steps will do is to simulate a future date and then trigger the SharePoint workflow engine.  If the engine finds any past-due activities (ex:  “Pause Until ___”) then it will execute those immediately.  Using this technique you can build “Pause Until ___” workflows and still test them to ensure everything completes as expected, without having to actually wait the full time.  Smile

 

image

image

image

image

Central Admin – one page with every icon

May 1, 2011 in Uncategorized

Solution:   One ASPX page which shows all Central Admins functions.

Background:  I was frustrated with clicking through the 8 different ASPX pages CA offers … or my lack of memory on where to find things.  For example, if you want “Timer Jobs” you need to first know to look under “Monitoring”.   That’s fine and it does make for an overall clean display.   However, I wanted to try something more streamlined for my DEV virtual machine.

  • Explore 14TEMPLATESiteTemplatesCENTRALADMIN
  • Copy “generalapplicationsettings.aspx” to “generalapplicationsettings.BAK”
  • Edit “generalapplicationsettings.aspx”  and insert the below content.
  • Open Central Admin with IE and click “General Application Settings”
  • You should now see a single page with every function.   From here “Ctrl+F” works great to quickly jump to functions.  No more clicking around guessing.  Just scroll the mouse wheel and you’re there.  Smile

TXT16 generalapplicationsettings.aspx

 

image

IIS 7.5 native SharePoint warm up (MUST SEE)

February 8, 2011 in Uncategorized

This one feature could be reason enough to upgrade to Windows Server 2008 R2 and IIS 7.5 when running SharePoint.  The unique ability to warm up memory cache while still serving users is something no basic scripting can achieve.  Please note: IISRESET seems to kill all workers and perform a classic flush followed by a warm up (brief outage).  However, INETMGR “recycle” on a single pool triggers the warm up in parallel for a zero outage experience.  Below is a diagram of my understanding of how this all works.  It’s not from TechNet … but hey … my budding art skills need more practice.  Hot

 

image

 

How to configure

  • Download x64 MSI from http://www.iis.net/download/ApplicationWarmUp
  • Login to Windows 2008 R2 as local admin and install
  • Open INETMGR and browse to the website that needs warm up
  • Open Application Warm-Up feature icon
  • Click Add Request and give the relative URL to the homepage ASPX (without / prefix)
  • Click Settings and check both boxes
  • Click Edit User Context, select “Set Username and Type only”, and provide Windows credentials.  This doesn’t have to be the farm account, but that’s what I used for simplicity.  Anyone with Read permission should work.

How to test

  • Open Internet Explorer to the homepage ASPX
  • Open CMD and Task Manager side-by-side
  • Type “IISRESET” and press enter
  • Type “APPCMD LIST WP” and press enter
  • Type “IISRESET” and press enter again
  • Refresh IE while watching Task Manager. 

You’ll see a new PID (process identifier) number for the newly created W3WP worker process.  The IE page should continue to load instantly without delay.  By running “APPCMD LIST WP” again you will see a new PID for the application pool.  The warm up feature has successfully created and warmed up a new worker thread without any outage.  The only downside I can foresee is the need for more RAM.   Running parallel W3WP threads requires more physical memory during the full process (recycle / warm up / release).

IIS 7.5 native SharePoint warm up (MUST SEE) from Jeff Jones on Vimeo.

image

image

image

image

image

Don’t Delay – PreUpgradeCheck Today!

September 9, 2010 in Uncategorized

More than 2010 upgrade readiness, this tool is a one stop 2007 best practices analyzer.   Most 2007 farms have dozens of small customizations.  Get started today because it will require time to take inventory and review the output.   The results help build a deep awareness of your system configs.  This command is read-only and safe to run in production any time, even during the work day.

So go ahead, RDP over and run “STSADM –O PREUPGRADECHECK” now!

http://bobfox.securespsite.com/foxblog/Lists/Posts/Attachments/120/PreupgradeCheck_2_3BF5F7FD.png

STSADM CMD with email output

July 11, 2010 in Uncategorized

Waiting and watching STSADM run on the CMD line is an exercise in patience.  Lately I’ve been incorporating two techniques to email myself updates for the freedom to walk away from the keyboard.

A quick command line EXE project allows me to send email by giving parameters (number 0-5).   If 5 is blank, no big deal just send a plain email with subject and body.   If 5 exists then attempt to open that text file, read content, and send as email body.

That’s great, but … how does this help me?  Great question!!

1) Send email at key script milestones

The freedom to walk away and receive alerts as progress continues allows you to be stay confident and know progress is moving forward.  Just add “SendMail.exe” inline with your existing CMD files to send an email at that step in the process.

 

2) Send email with script outcome

The detailed knowledge of what return value came from the CMD when it finished is helpful.   Imagine running a site move (STSADM backup/delete/restore) and heading out for dinner.   It’s very nice to get an email showing “Operation completed successfully” three times.  Smile   Just use “SendMail.exe” with parameter 5 being the text file full path and name.

image

image 

using System;
using System.Collections.Generic;
using System.Text;

using System.Net.Mail;
using System.IO;

namespace SendMail
{
    class Program
    {
static void Main(string[] args)
{
    //0-from
    //1-to
    //2-subject
    //3-body
    //4-server
    //5-filename

    string textFile = "";
    if (!String.IsNullOrEmpty(args[5]))
    {
        //send text file as body
        TextReader tr = new StreamReader(args[5]);
        textFile = tr.ReadToEnd();
        tr.Close();
    }

    //create message
    Console.WriteLine("from {0} to {1} subject {2} body {3} on server {4}", args[0], args[1], args[2], args[3], args[4]);
    MailMessage message = new MailMessage(args[0], args[1], args[2], args[3]);

    //if file was given modify body
    if (textFile != "") message = new MailMessage(args[0], args[1], args[2], textFile);
    SmtpClient emailClient = new SmtpClient(args[4]);
    emailClient.Send(message);
}
    }
}

Unlock ASMX for easy manual invoke (developers)

July 6, 2010 in Uncategorized

For SharePoint development I like to use the .ASMX web services for reading data.  Out of the box default security prohibits manual remote HTTP queries.  A quick edit to “C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIweb.config” for changing <protocols> from “remove” to “add” and then you’ll be able to manually Invoke.

The raw XML returned by a manual invoke is incredibly valuable for developers.  Open-mouthed

Before (out of the box)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
    <system.web>
        <webServices>
            <protocols>
                <remove name="HttpGet" />
                <remove name="HttpPost" />
                <remove name="HttpPostLocalhost" />
                <add name="Documentation" />

image

After (unlocked for development)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
    <system.web>
        <webServices>
            <protocols>
                <add name="HttpGet" />
                <add name="HttpPost" />
                <add name="HttpPostLocalhost" />

                <add name="Documentation" />

image

Always use CMD files

July 3, 2010 in Uncategorized

I rarely use absolutes but CMD files are amazing and you really should always use them.  For anything, no matter how small.

Why bother?  What’s in it for me?

  1. Easy to repeat
  2. Easy to test
  3. Can modify while running

The only cost is time.  It takes a little longer to build a CMD file and plan it out.  However, measure twice and cut once pays off with quality.  Let’s explore the benefits one at a time:

  1. Reusing a CMD file is very easy.  Search replace in Notepad++ can switch scope easily.  Also, input parameters like %1, %2, etc. can make the tool modular for using in a slightly different way quickly next time.
  2. Copy a CMD file to lower environments for practice is quick, easy, and helps mitigate risk.  Before you typo against production, try copying the file to a different server first.
  3. This is awesome and very little known!   While a CMD file is running (after you hit enter) you can still open Notepad.exe and modify the file.  Adding an extra line, commenting out with REM, or removing a line can all be done.  As long as CMD has not made it down to that line already you’re edits will be picked up as it steps down.   Great for real-time adjustments.

Thanks for reading!  Open-mouthed

image

HowTo: Append “ToolPaneView=2” to edit ASPX forms (New, Edit, Display)

May 12, 2010 in Uncategorized

Have you ever wanted to add a web part to a SharePoint page (New, Edit, Display Form) and not found the “Edit Page” option under Site Actions?  Here’s a little trick for getting into Edit Page mode.

clip_image002

Add ?PageView=Shared&ToolPaneView=2 to the end of your URL and hit enter.

You’ll now be in edit mode and can add additional web parts to your page. Easy!  Smile

clip_image004

FIXED – DeleteElementAddToMyColleaguesURL People Search

May 6, 2010 in Uncategorized

If you ever see the below People Search error go double check your indexed User Profile Properties.   I saw this recently and the root cause was a missing “Indexed” checkbox.   Enabling the Indexed checkbox for Account Name and crawling again fixed the issue.   Thanks to Puneet for the tip on this one.

System.NullReferenceException: Object reference not set to an instance of an object. at System.Xml.XmlNode.RemoveChild(XmlNode oldChild) at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.DeleteElementAddToMyColleaguesURL(XmlNode result) at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.CreateXmlDocument() at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.SortBySocialDistance() at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.GetXPathNavigator(String viewPath)

image

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp>
<xsl:copy-of select="*"/>
</xmp>
</xsl:template>
</xsl:stylesheet>

[Me] = Easy Item Level Security

March 4, 2010 in Uncategorized

Ever wanted item level security in SharePoint without the headaches?   It’s easier than you might think. 

Business Goal:   Provide a personalized dashboard where application owners can confirm they still need the system access they have.   This access review should be quick and easy, so limiting the display to only records they need would be great.

Technical Design:   SharePoint custom list with a multi-person column (“team”) and view filter [Me] to display only your records.   The multi-person column can hold any user in the User Information List of your site collection.    If you don’t see someone’s name here you will need to first grant them permissions (i.e. Contributor) and then come back to edit.    The permission grant will register their name into the site collection so you will see it in the drop down menu.   Despite having multiple values the =[Me] filter works perfectly to match only records where the visitor’s name is listed.   You can also use DataSheet edit mode here to fill down (or copy/paste) and update many records quickly.   Generally on a project like this many records will have a common “team” of people to review.

a3-3-2010 10-20-12 PM

image

Action Steps

  • Create custom list with your columns plus a multi-person column “team”
  • Grant site permissions
  • Populate the list.   For “team” select people who will see/edit their own records.
  • Modify the default view, add filter “team=[Me]‘”
  • Test with a few pilot users
  • Send one email with the link and everyone will see a personalized list when they visit.

 

NOTE:  “security through obscurity” is not a best practice for highly sensitive or confidential data.    If the data has a firm require to not be viewed by a third party you’ll want to implement SharePoint’s true item level security feature.   http://www.codeplex.com/SPDActivities  has a great action step for granting security that can help automate to create a sustainable and reliable security enforcement.  (thanks to @unclepaul84)

Video Walkthrough (03:39)

How to build the sample list in full step-by-step video with a demo of the final working product.

[Me] = Easy Item Level Security from Jeff Jones on Vimeo.

Return to Top ▲Return to Top ▲