Monday, June 24, 2013

SharePoint list rollup - url references to child lists

Asked to create a view which rolls up list libraries on subsites to a central parent site list.
The view needed to list each item link relative to its list and not the parent list url.

This required use of the XPath functions substring-before/after.  XPath does not define a function
lastIndexOf or IndexOf.  Would be nice to have these!

Problem was that though the parent list did provide the url path back to the child list it did not include
the item ID.  This means you have to parse the url and build the url reference in Xpath.

Sample:

URL = fullurl/Lists/LibraryName/Filename

<xsl:variable name="tempurl" select="substring-after(@fileRef,'Lists/')"/>
<xsl:variable name="directory" select="substring-before($tempurl,'/')"/>
<xsl:variable name="url" select="substring-before(@fileRef,'Lists/')"/>

<xsl:variable name="tasklink" select="concat($url,'Lists/',$directory,'/DispForm.aspx?ID=',@ID)" />

<a href="{$tasklink}"><xsl:value-of select="@Title"/></a>


SharePoint Designer, XPath, LastIndexOf,@FileRef

Wednesday, June 19, 2013

An Unexpected error has occurred (MOSS 2007)/FIPS issue

Finished an install of MOSS on a box and tried to bring up Central Admin.
 I received this most informative message! 

An Unexpected error has occurred

Step 1:
First thing to do was to get the actual error message.
 Tweak the web.config in WSS
 1.) Modify the web.config and set debug="false".

Note: Some blogs mention the work around
<configuration>
    <runtime>
        <enforceFIPSPolicy enabled=”0” />
        <!-- or maybe ="false" -->
    </runtime>
</configuration>
The issue here is that if you need FIPS compliance then you can't just turn off the policy.


Step 2:
Now I was getting the actual error - Unable to validate data.  The application log listed Event ID 1309/Event Code 3005.  The key was the validation error.  This lead me to a common error in our environment.

 Issue:
Group Policy enforced on our servers sets fips policy to 1
(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\fipsalgorithmpolicy)

MOSS 2007 is built on 2.0 of Framework which uses the RijndaelManaged implementation of the AES algorithm when it processes view state data.  The RM implementation has not been certified by the NIST as compliant with the Federal Information Processing Standard (FIPS).  Therefore the FIPS algorithm is not part of the Windows Platform FIPS validated crytographic algorithms.  Enforcing FIPS means that state data in MOSS can't be decypted properly.

Solution:

Modify the Machine.config file
1.) Open machine config at %installdir%/microsoft.net/Framework/v2.0.50727/Config
2.)Locate <system.web>
3.)Add following block
<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="3DES" decryption="3DES"/>
4.)Save machine.config
5.)iisreset

Friday, June 14, 2013

BrownField Code Adventure

Yippee, I have inherited an application which the customer has asked me to "tweak".  This is an .Net C# application which began life in VS 2005 on IIS 6.  We need to get it too VS 2010 SP1 IIS 7.5.
Here is what I have experienced so far:

1.) This was a website solution vice a web application which is my preference when working with these types of applications.  I tried to copy and paste the files over and was reminded of this pit fall.
  • Designer pages which contains all the globals for the controls is not present in a website solution.
  • Markup Header files use the CodeFile vice CodeBehind keyword
  • Namespace was not aligned with the web project name but can be fixed.  That means patch each class with the new namespace for the application.
2.) String handling using the namespace Microsoft.VisualBasic.Strings!  What happened? String is part of the System namespace most classes inherit the string from the System namespace.

Here is what I found:
return Path.Combine(TraceLogsPath, "TraceLog." + Strings.Format(DateTime.Now, "yyyy.MM.dd") + ".xml");

What is SQL Client Connectivity SDK in SQL 2008 R2 Installer

During an install I was wondering what this option did?


SQL Client Connectivity SDK and Client Tools SDK provided the Wrapper objects for COM components.

Client Tools SDK Provide wrappers classes for DTSRuntime and similar components that you can use to Execute a .dtsx (SSIS) package on demand. Most of the People install Integration Service to perform similar task.

Also SQL Client Connectivity SDK plays a key role in providing Microsoft.SQLServer.Diganostics.STrace library used by Client Tools.

Now, you can use this Wrapper classes to run a SSIS package from within your WCF/WebService/Windows Service or any other .Net App without calling a SQL Agent Job.

there are probably more uses to this library and would be great if someone added to my comment.

Thanks Pawan Gonnakuti
http://connect.microsoft.com/SQLServer/feedback/details/381445/sql-client-connectivity-sdk-and-client-tools-sdk-documentation

Tuesday, June 11, 2013

Cannot Open User Default Database (error 4064) - SQL database lock out recovery

In my haste to recreate a database, I neglected to set my account back to the default master.
Now each time I attempt to login, SQL Server issues error 4064 as it attempts to connect to a
catalog which is not longer there!

Fortunately, Laurentiu Cristofor at http://social.msdn.microsoft.com/forums/en-US/sqlsecurity/thread/b32c862a-799c-43c4-a731-c4811078c8bd/

Had the solution:

C:\> sqlcmd -E -d master
1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master
2> GO

Brownfield coding - Silverlight 4 Toolkit installation vs. Visual Studio 2010 SP1

Had an opportunity to patch some Silverlight 4 code which we have installed.  Did not have the environment set up and tried to install Silverlight Tools 4 .exe.("Single Install" for Silverlight Developer runtime and the tools.)

Each time I ran the exe it failed telling me that their was a conflict with my current install.  I snooped around and found several tips guides based around RC version software.  Did finally hit upon the issue which was Visual Studio 2010 SP1.  It conflicts with the version 4 install.  So I removed SP1 from the box and reran the install without issue. 

Visual Studio 2010 sp1 full iso

Needed a full copy of the sp1 iso for a disconnected network.

Microsoft has this link set up for just such a need.

http://go.microsoft.com/fwlink/?LinkId=210710