Monday, March 14, 2011

Infopath xqueru no working

This happens a lot in Infopath, XML that has different namespaces. or funnier, the namespace changes... You need code that can work out is namespace programmatically.

XPathNavigator root = MainDataSource.CreateNavigator();
string fieldValue = root.SelectSingleNode("//*[local-name()='field1']").Value;


http://www.bizsupportonline.net/blog/2009/01/specify-namespaces-use-xpath-queries-infopath/

How to connect to Excel Services with FBA

Lets say you have a site that uses forms based authentication, like an internet facing site. And then lets say that you are using Excel Services on the same farm.

So what you need is to make a cookie:

ExcelWebService.ExcelService excelService = new ExcelWebService.ExcelService();
debugWriterOutput("eService: " + excelService.Url);

excelService.CookieContainer = new CookieContainer();
excelService.CookieContainer.Add(Utilities.FBACookieAuthentication(excelService));

ExcelWebService.Status[] status;





internal static Cookie FBACookieAuthentication(ExcelWebService.ExcelService excelServiceSoapClient)
{
Authentication.Authentication auth = new Authentication.Authentication();
auth.CookieContainer = new CookieContainer();

LoginResult result = auth.Login("LoginName", "Password");

CookieCollection cookies = auth.CookieContainer.GetCookies(new Uri(auth.Url));

Cookie authCookie = cookies[result.CookieName];

return authCookie;
}

SharePoint stsadm scheduled backup

This summary is not available. Please click here to view the post.

Can't access SharePoint site after restore

This summary is not available. Please click here to view the post.

Find Tables in SQL by column names

if you are like me and often get called in to stabilize a disaster, you will need to get an understanding of the database really fast, and seen as its a disaster there will be no-one to explain the schema

This useful script will help you to find the links



find tables in sql with cols =


DECLARE search_Cursor CURSOR
FOR select o.name from sysobjects o where o.name like 'XXX%' and type = 'u' order by o.name

OPEN search_Cursor

declare @TableName varchar(100)

FETCH NEXT FROM search_Cursor
INTO @TableName


WHILE @@FETCH_STATUS = 0
begin

declare @ExecString varchar(250)

select @ExecString = ' select * from ' + @TableName + ' where Status = ''' + 'd' + ''''

print @ExecString
exec (@ExecString)


FETCH NEXT FROM search_Cursor
INTO @TableName

end

CLOSE search_Cursor
DEALLOCATE search_Cursor
GO

Task failed because "sgen.exe" was not found

If you get this error just copy the file, don't even need the sdk

Error 1 Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task. Unlock

Task failed because "sgen.exe" was not found


If you get this error just copy the file, don't even need the sdk

Error 1 Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0. 2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task. Unlock