SPD custom workflow actions — string manipulation enhancements

About a week ago, I started up a codeplex project that provides a simple and reasonably generic method for adding custom action functions to SharePoit Designer workflow. It’s described here: http://www.codeplex.com/spdwfextensions. Beyond simply providing a framework, it also aims to provide a set of useful functions that will make SPD more useful/flexible/powerful.

Here are the current planned features for version 1.0: https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=spdwfextensions&ReleaseId=8280

If anyone has any interest in this project, please leave a comment or start/add to a discussion here: http://www.codeplex.com/spdwfextensions/Thread/List.aspx

Here are the current set of functions that have been coded (though not fully tested as of 11/08/07):

Munus Descriptio (si non idem. Net munus)
NUM-entries() Redit in numero "entries" in a string as per a specified delimiter.

Verbigratia: Num-entries in a string "a,b,c" with delimiter "," = 3.

Entry() Returns the nth token in a string as per a specified delimiter.
Longitudo String.Length
Restituo() String.Replace()
Continet() String.Contains()
Returns the word "true" or the word "false".
Substring(Committitur) String.Substring(Committitur)
Substring(Committitur,finem) String.Substring(Committitur,finem)
ToUpper() String.ToUpper()
ToLower() String.ToLower()
StartsWith() String.StartsWith()
Returns the word "true" or the word "false".
EndsWith() String.EndsWith()
Returns the word "true" or the word "false".

Velox & url desktop utilitas facile Encoding

I’ve been needing to url-encode some strings this week and slapped together a a little utility that I thought I’d put up on SkyDrive for the community.

Adepto hic binarius: http://cid-1cc1edb3daa9b8aa.skydrive.live.com/self.aspx/SharePoint/WinUrlEncode.zip

SOLUTIO Hic adepto Visual Bulla: http://cid-1cc1edb3daa9b8aa.skydrive.live.com/self.aspx/SharePoint/WinUrlEncodeVS2005.zip

Hic 'a screen iecit:

imaginem

Quick and easy: Embed a hyperlink into data view web part XSLT

UPDATE (01/17/08): This blog entry talks about more hyperlink XSL goodness: http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/rewriting-links-in-search-results-xslt.

Overview et obiectiva: I had created a simple bar chart to serve as component on a dashboard. I’ll save the details on building charts for another post, but I did not invent that technique (nor the question mark, for that matter). It turned out there was a bug in the chart and while I fixed that, I took the opportunity to convert some labels into hyperlinks that pointed at the underlying list behind the graph. Verbigratia, there is a label with value "Hold". I wanted to turn the label into a hyperlink so that the user could click on it and drill down to the specific entries in the list whose status value is "Hold".

Steps:

  1. Use visual studio for sharepoint-aware intellisense.
  2. Copy the DVWP’s XSLT into visual studio (create a blank project, add an XSL file to the project).
  3. Copy the link you want to use into the clipboard.
  4. Paste it into the right location in the XSL.
  5. Convert URL argument separators on the query string from "&" to "&"
  6. Url-encode individual arguments.
  7. Wrap that inside an <a href…> </a>

Verbigratia:

I have an URL:

http://[server]/[site]/Lists/Open Positions/AllItems.aspx?View={84EEA2F5-121B-40B7-946F-0FA704A1DAA1}&FilterField1=Recruiter&FilterValue1=Hold

I convert it into:

     <a href="Lists/Open Positions/AllItems.aspx?View={84EEA2F5-121B-40B7-946F-
0FA704A1DAA1}&amp;FilterField1=Recruiter&amp;FilterValue1=Hold"> Hold: </a>

I have manually transformed the first argument from:

{84EEA2F5-121B-40B7-946F-0FA704A1DAA1}

ad:

%7b84EEA2F5-121B-40B7-946F-0FA704A1DAA1}

(In this, the open brace transforms to { and the closing brace transforms to })

The second and third arguments’ parameters ("FilterField1=Recruiter" and "FilterValue1=Hold" respectively) do not need to be url-encoded because they do not contain any unsafe characters.

Notes:

This technique should generally work anywhere you want to embed a hyperlink in XSLT where the hyperlink includes parameters on the URL such as:

http://[server]/[site]/Lists/Open Positions/AllItems.aspx?View={84EEA2F5-121B-40B7-946F-0FA704A1DAA1}&FilterField1=Recruiter&FilterValue1=Hold

I got the URL itself by accessing the custom list and manually filtering on the status column (labeled "Recruiter" above).

Vivos et Simplex: Enable SharePoint Designer workflow ad update in forma InfoPath

Missionem: I have an InfoPath form that front-ends a workflow process implemented using SharePoint Designer. At one point, a manager must approve the form. Since I cannot count on workflow history to meet my auditing requirements, Statuo mea absconderis auditing verbum immediate per ipsam formam;.

Overview:

Design the form and publish it as a content type and the form itself to a document library. Mark desired form fields as being updateable from MOSS. The form is tied to the content type and the content type is "attached" to a forms library (or many, if you want). Write a workflow that updates the field.

Specific Steps:

  1. Create a document library. This will hold your InfoPath template.
  2. Create a forms library.
  3. Create the InfoPath form. Include a text field, "Audit Message".
  4. Publish the form as a content type (NOT a document).
  5. While filling out the publishing dialogs:
    a) Save the .xsn file to the document library (step #1).
    b) Publish the "Audit Message" field and mark true: "Allow users to edit data in this field by using a datasheet or properties page".
    c) Create a new content type and give it an appropriate name.
  6. Access the forms library.
    a) Go to its advanced settings and enable the forms library to manage content types.
    b) Select the newly created content type (5c above). It will be grouped under "Microsoft InfoPath" (or similar).
    c) Remove the default "Form" content type from the library.
    d) Mark the library to "show as web page" so that the form will launch from SharePoint and not the InfoPath workstation client.
  7. Go back to the forms library proper and click "New" to simply verify that the form is posted correctly and acting as you want.
  8. Fire up SharePoint Designer and navigate to the site that hosts your form library (from step 2).
  9. Create a new workflow attached to the forms library.
  10. Add a single action "Set Field in Current Item". You should expect SharePoint Designer to list your your field, "Audit Message". Assign it a value.
  11. Click Finish and go back to the form library.
  12. Create a new form and put some test value into the "Audit Message" agrum.
  13. Save it and go back to the form library.
  14. Right-click, select "Workflow" and start up your workflow.
  15. It should run almost immediately. Pull up the form (from step 12) and if all has gone to plan, "Audit Message" has been assigned whatever value you provided in step 10.

Notes:

Not all controls may configured for this bi-directional communication. Verbigratia, it does not seem to implement an SPD workflow that modifies text fields wrapped inside repeating sections.

One of the key take-away’s here is that we’ve really created a content type with an associated template. This also enables us to store multiple InfoPath form templates in the same form library.

This requires forms server. It’s most certainly not going to work in a WSS 3.0 environment and probably even requires an Enterprise SharePoint environment.

The Beagle has Landed (Octobris 2007 issue)

(This is actually a little old news, but as my favorite fire station motto proclaims, "Better late than never").

Check it out here: http://www.sharepointbeagle.com/

If you have not already, be sure to sign up.

Utique, be sure to read articulum about a real-world SharePoint project (including requirements definition, KPI’s, content genera, dashboards and more) as well as my colleague’s article about the content query web part.

There’s lot of other good stuff too.

How to remove “View all site content” link

I’m asked this question nearly every week, normally in the context of a security discussion. An administrator/site creator has provisioned a site, configured security, arranged web parts and customized the quick launch to provide that oh-so-perfect set of options to the end user. Sed, out of the box, you can’t remove the "view all site content" link.

Mark Wagner provides the answer hic (http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=36). His write-up is terrific on two levels. It provides an answer to the question, "How do I remove the View All Site Content" link? Igitur, it answers the immediate follow-on question: How do I easily enable the view all site content link on a site-by-site basis?

As a bonus: His approach works for WSS, not just MOSS.

</finem>

Scribet ad mea blog!

Praesent ipsum mi CodePlex: Workflow tractus pro SharePoint Designer

UPDATE: En (http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!310.entry) Tardus est enim super hoc project.

I created a CodePlex project today to house the Generic SPD interface code that I blogged about hic (http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!275.entry).

Have a look at hic (http://www.codeplex.com/spdwfextensions) Videre exertus CodePlex et calcitrare summae.

Quod si tu mihi cura opus, fire off an email at mailto:galvin.paul@gmail.com

SharePoint amet — Consuetudo definitur actio facere user-C # functiones

UPDATE: Hoc dimissum est hic CodePlex: http://www.codeplex.com/spdwfextensions

UPDATE: Vide hic in notis tardus remissionis: http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!381.entry

UPDATE: Hic meo cogitationes in commercializing hoc project: http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!569.entry

This project provides a custom activity in SharePoint Designer. Use this custom activity to invoke (confodiantur) any C# function that you incorporated into the linked assembly.

Ut nuper October, 2007, this is just an initial version of the project. I plan to expand it with a number of additional functions, possidet substring, Index, restituo, invoking web services and anything that seems useful or interesting. I also plan to post this to codeplex once I have my act together on that front. This will also be deployable as a solution at some point.

Si vos have ullus ineo, vel quaestiones proponentibus, mihi comments in eis placere relinquere an email.

Disclaimer:

I make absolutely no claims as to the suitability of this for any purpose. Use at your own risk.

Gradibus instruitur (Quisque in agro sequi WFE):

1. Download. Zip et eruere,.

2. Install the .dll into the GAC. I usually open c:\fenestrae collectam usura Fenestra Rimor et non rescribatur.

3. Abilitates web.config adicere coetus ad imperium securum:

<System.Workflow.ComponentModel.WorkflowCompiler>
<authorizedTypes>

<authorizedType Assembly="SpdGenericInterface, Version = 1.0.0.0, Culturae = neutra, PublicKeyToken = abe076fd8125f3c4" Namespace="Nivlag" TypeName="*" Authorized="True" />

4. Copy "SpdGenericInterface.actions" C:\Progressio Lima Commune Lima Microsoft Communes meaning Maecenas lobortis XII Template MXXXIII workflow

Nota quod situm superius specificum anglicus Linguam installations.

5. Excogitatoris SharePoint Close (si suus 'iam patefacio).

6. iisreset

7. SPD et aperire novum workflow.

Si omnes bene, Retribuetur enim tibi novo genere actionis:

imaginem

Notes:

Videte hic (http://blogs.msdn.com/sharepointdesigner/archive/2007/03/15/adding-activities-to-spd.aspx) pro ingenti overview of processus partum, Vestibulum et installing solutio huiusmodi.

In. Zip ordinatur directe ad vos can extraho:\ drive. If you do this, et omne consilium tui vias suas aperire futurum.

Uti hoc in Visual Bulla, you probably need to install "Extensions for Windows WF".

The initial upload contains just one "dispatcher function", "ToLower()". To add more functionality, adde Facite ostenditur ratione,:

 protegetur dominari ActivityExecutionStatus
          Fáciant(ActivityExecutionContext executionContext)
        {

            filum functionToDispatch;
            functionToDispatch = hoc.DispatchFunction.ToLower();

            switch (functionToDispatch)
            {
                casum "tolower()":
                    {
                        hoc.OutResult1 = hoc.InParam1.ToLower();
                        diruam;
                    }

                defaltam:
                    {
                        hoc.OutResult1 = "Unknown function: [" + hoc.DispatchFunction + "].";
                        diruam;
                    }
            }

            revertetur ActivityExecutionStatus.Concluserat;
        } // ActivityExecutionStatus

    }

Igitur, re-build the project and copy the assembly to the GAC. I expect an iisreset would be required.

SPD workflow consuetudinem actione – impetro <WorkflowInfo> tag ius ad vitare uanitate

Part of the process for creating a custom action for SharePoint Designer involves create a ".actions" file.

Ive et inhiberet specimen Template quam ut satus off:

<?XML version="1.0" Encoding="utf-VIII" ?>
<
WorkflowInfo xmlns="http://schemas.microsoft.com / sharepoint /">
<
Actiones Sequential="igitur" PARALLELOS="et">

Autem, that xmlns attribute prevents my environment from working. My actions don’t show up in SPD.

Solutio est ut spoliaretis ex attributo xmlns, do an iisreset and close/re-open SPD.

Vivos et Simplex: Configurare musco quaerere specialis libraria document

See UPDATE (Ego) below (11/24/07) on How to Configure Microsoft Office SharePoint Server 2007 to Index and Crawl Network Folders for Search

Objective: I want to execute a search restricted to a specific document library. In hoc, the document library contains training documents.

Steps:

1. Record the URL of the document library.

2. Create a scope:

Go to central administration.

Access the SSP.

Go to "Search Settings".

Scroll down to the scope section and select "View Scopes".

Create a new scope. Give it a name and useful description.

3. Define scope crawl rules:

Add a rule that defines the document library for this scope.

Select "web address" for "Scope Rule Type".

Enter the name of your folder (videre #1 above).

Accept the default value of "Include".

Wait for the scope to update (or start it manually).

4. Enable the scope in a site collection.

Go to site collection where you want to use this scope.

Add your new scope to the appropriate display group or groups.

5. Quaerere!

Ad hoc, you’re done. Assuming the scope is properly defined, it will be available in the scopes drop downs for simple and advanced searches and when you search using that scope, you’ll just get results you expect.

Notes:

I wrote this blog entry because my searches for simple scope setup turned up dry using phrases like:

  • configure scopes in MOSS
  • configure search scope moss
  • scopes in sharepoint 2007
  • scopes in sharepoint
  • search a document library moss
  • scopes primer moss

You can create a search scope on a folder, not just the entire document library.

A scope can be shared across multiple site collections (Hinc, a "shared service").

You can create the scope at the site collection level itself. Autem, I prefer to go to central admin because I can start the crawl from there. You cannot start the crawl from the site collection.

UPDATE (Ego) tamquam 11/24/07:

Kai Shang put together a great post entitled How to Configure Microsoft Office SharePoint Server 2007 to Index and Crawl Network Folders for Search @ http://kaishenghoo.spaces.live.com/blog/cns!8A7458DB12CA5AC9!206.entry