Understanding Data View Web Part in SharePoint 2010

December 31, 2013

Let’s see how we can connect a Display Form for a list to a Data View Web Part (DVWP).

First create a new Display Form for your respected listed.

image

Next insert a new DVWP using the list you want to link to.

image

Next you add or remove the columns to display.

image

Add a new Parameter using the Query String Source. In this case the ID field.

image

And last add a new Filter. Where you select the Form Field to send to the Query String Parameter to filter the DVWP list.

image

TIP : When defining the filter Value field, make sure you browse to the bottom of the drop down list, in order to see the Filter Parameter Value option.

This result looks like this.

image

Enjoy !


w3wp.exe unable to authenticate on target name

December 27, 2013

Had SharePoint interact with Word QuickParts to do some Field Merging. And this did not get going Sad smile

So it must have had something to do something with security. After investigating the ULS logs I saw some ‘401’ errors appearing.

Next was to jump to the EventViewer to check it out. And this one was clearly in the middle.

LsaSrv – EventID 6037

image

image

Adding this regkey solved all issues

  1. Go to REGEDIT and open the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  2. Right click MSV1_0 –> New -> Multi-String Value
  3. Type BackConnectionHostNames and click Enter.
  4. Right click on newly created value and select Modify.
  5. Enter the hostname of the site: WEBSITENAME (and on a new line enter the FQDN, WEBSITENAME.domain.com)
  6. Restart IIS

image


SharePoint – Return a Lookup Column Value as Text

December 21, 2013

The most annoying thing in SharePoint is that if you have a lookup column value in a list. And you want to retrieve this value as a text it will not work OOTB.

Let’s see here what I mean :

When you want to show a lookup column called CRM_Account using the standard “xsl” syntax.

<td>
           <xsl:variable name=”ID”>
            <xsl:call-template name=”ResolveId”>
                <xsl:with-param name=”thisNode” select=”$thisNode” />
            </xsl:call-template>
        </xsl:variable>
    <xsl:value-of select=”$thisNode/@CRM_Account”/>
</td>

You get this onclick=”OpenPopUpPage Hyperlink result, instead of the text of the lookup column.

image

When you add this xsl syntax you will get the correct text representative of the lookup column value. 

<xsl:value-of select=”substring-before(substring-after($thisNode/@*[name()=current()/@Name],’&gt;’), ‘&lt;’)” disable-output-escaping=”yes”/>

How to set a variable and set a value to retrieve in a new column.

Set a variable called CRM_ID and put the CRM_Account_ID in there, last is to retrieve it.

<xsl:variable name=”CRM_ID”><xsl:value-of select=”$thisNode/@CRM_Account_ID”/></xsl:variable>

<xsl:value-of select=”$CRM_ID”/>

Enjoy !


SharePoint start Workflow from a Dynamic Hyperlink in a list

December 19, 2013

Ever wanted to start a Workflow from a Hyperlink in a list, that is filled dynamically with the URL and the corresponding ID of the ITEM.

Ok let’s go

Op SharePoint Designer and go the list you want it to happen. Next open the VIEW where you want to add the Hyperlink Column.

image

Go to the Columns section and right click the first column, and select Insert to the Left.

image

Next make sure you have the SP Toolbox available if not; Go to Tasks Panes and Select Toolbox. And Drag & Drop a LinkButton in the new column.

imageimage

The code will look as follows

<asp:LinkButton runat=”server” id=”LinkButton1{$ID}{generate-id()}”</asp:LinkButton>

Modify it to trigger the Workflow URL and parameter

Add the PostBackURL=” “ URL & Parameter

image

The Parameter is this case is = {$thisNode/@ID}

The result looks like this.

image

And works like this when clicking.

image

IMPORTANT :

If you embed the List View in another Page using insert WebParts .You need to add the custom column again in that page !! It will not be automatically added if you did the change in the original View.

Enjoy!


SharePoint Custom Action in Ribbon

December 18, 2013

Ever wanted to PRINT your list or your custom Form you created.

Well the easiest way would be to add a Custom Print Action to your ribbon or List menu.

To start open the relevant list or form in Sharepoint Designer. In this example it will be a list.

Add a new Custom VIEW Ribbon action

image

Call it “Print” and add this simple JavaScript to the Navigate URL.

image

javascript:
alert('I am Printing now !');
window.print();

Important is that you add this Ribbon Location :

Ribbon.ListItem.New.Controls._children 

image

Don’t forget to add your 32bit icon and save it.

image

Next go to have a look at the result and test it.

image

image

The same procedure goes for a form only the Custom Action location is different.


Redirect Workflow Page after starting

December 16, 2013

Sometime you create a Workflow (WF) and you don’t want it to redirect to the initial list where it was started from.

But rather to a Display Form or an Edit Form of the record that triggered the WF.

Let’s see how to redirect a workflow to a different page after starting.

1. In the style sheet create a parameter that will contain the URL of the form to which to redirect to :

<xsl:variable name=”RedirectDisp“>../../Lists/YourList/DispForm.aspx?ID=<xsl:value-of select=”$Id“/></xsl:variable>

Where $ID is the ID of the list item

image
2. Then change the start button from the WF page :

<td nowrap=”nowrap” class=”ms-vb”>
<input type=”button” value=”Start” name=”btnSave” onclick=”javascript: {ddwrt:GenFireServerEvent(concat(‘__insert;__commit;__redirectsource;__redirectToList={‘,ddwrt:EcmaScriptEncode($ListName),’};‘))}” />
</td>

To

<td nowrap=”nowrap” class=”ms-vb”>
<input type=”button” value=”Start” name=”btnSave” onclick=”javascript: {ddwrt:GenFireServerEvent(concat(‘__insert;__commit;__redirect={‘,$RedirectDisp,’}‘))}” />
</td>

image

That’s it.


SharePoint – Workflow Event manager error

December 12, 2013

SharePoint Workflow – On Event Change issues !!

In a custom SharePoint Application we encountered the problem that a Workflow connected to a list.

Which was part of the Custom SP application was not starting based on a ON CHANGE event.

Every time we changed the record we saw this in the ULS.

Event manager error: That assembly does not allow partially trusted callers.

image

Solution is to go the the %windir%\assembly Directory and Drag & Drop the DLL in there. This will register them without the need of the GacUtil.exe

image

Do a IISReset and test again.

It it did not solve the issue you need to go a more insecure approach but more effective for sure.

Open the IIS Manager go to your Web Application, right click and choose Explore.

image

You will end up in the correct folder where you can pick up the web.config file.

Find this entry :

<trust level=”WSS_Custom” originUrl=”” />

And change “WSS_Custom” to “Full

Enjoy !