Monday, March 14, 2011

SharePoint FBA Error

Was getting this error
The password-answer supplied is invalid

added:

enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
/>

FBA SharePoint error

"A Membership Provider has not been configured correctly. Check the web.config setttings for this web application"

changed applicationName="/" to applicationName="???"

This broke everything

FBA can be configured for multiple applications, changing the applicationName has far reaching consequences, especially when restoring

Format T-Sql

Sometimes I inherit disasters. The kids of people who make disaster are to useless to format code.

That's why I use:

http://www.ubitsoft.com/products/t-sql-beautifier/index.php

otherwise I can't tell what the h_ll is going on.

Manually editing data connection details in InfoPath 2007 forms

Imagine if someone kills the InfoPath server, and you have to get the InfoPath from the Live and then do maintenance.

First problem is that the InfoPath still wants to point to the original server.

You can fix this by renaming the .xsn to .cab, and extracting the files. open the manifest file, reset the URLS to whatever the new server is.

Then you need to turn it back into an xsn. To this, download cab maker.

In Cab Maker, create a .cab file. rename the .cab to .xsn and viola, is InfoPath again.

See http://support.microsoft.com/kb/176810 on how to make a cab


Rename edit etc

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

You can and should use the SQL server to backup the databases.

But its slow and annoying to get it to restore. Also you get issues if you did not mark the content db's for the move. And even more tiresome is if the dev/qa/live are differnetly named and so on.

Instead stsadm will give you the site collection backup, which is a million times faster than going through a dba.

Make a scheduled task in windows scheduler. make a .bat file, add this:

cd\
cd "c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
stsadm -o getsitelock -url http://xxx.co.za
stsadm -o setsitelock -url http://xxx.co.za -lock readonly
stsadm -o backup -url http://xxx.co.za -filename "D:\xxx\xxx.dat" -overwrite
stsadm -o setsitelock -url http://xxx.co.za -lock none


Note that you need the site locks, or else the backup will break.

Can't access SharePoint site after restore

You may get these errors:
You need to be a site collection administrator to set this property.
Can't access site with farm, site collection administrator accounts

do this
stsadm -o setsitelock -url http://xxx.co.za -lock none

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

Users can't open office docs

This one plagues SharePoint installations.

Users can't open document in libraries from a link, they get multiple prompts, nothing happens

See problems here:
http://support.microsoft.com/kb/932118
http://support.microsoft.com/kb/871155
http://blogs.msdn.com/b/sharepoint/archive/2007/10/19/known-issue-office-2007-on-windows-vista-prompts-for-user-credentials-when-opening-documents-in-a-sharepoint-2007-site.aspx

See solutions here
http://www.uv.mx/personal/gvera/2010/09/28/sharepoint-login-prompt-when-accessing-files-in-a-document-library/
http://stackoverflow.com/questions/375390/office-documents-prompt-for-login-in-anonymous-sharepoint-site

Infopath Schema not Updating

Had an InfoPath form that calls a web service, that calls a SQL Procedure.

Logic in the stored proc was causing it return datasets that looked the same, the result sets were created dynamically. Problem was they had different datatypes. So when run the form you get strange behavior.

You could do an ODBC trace, which will show you how the procs callers (the drivers) do to the datatypes.

Or, you could have the proc fill a temp table, this way the result set it always the same

The form template is not browser-compatible

I have some InfoPath forms that I need to upload, I keep getting this error, "The form template is not browser-compatible. It might be possible to correct the problem by opening the form template in Microsoft Office InfoPath, and then republishing it."

Except, I can't figure out why. It will disappear after some beating.

http://www.thorprojects.com/blog/archive/2008/03/11/infopath-forms-services-%E2%80%93-the-form-template-is-not-browser-compatible.aspx
http://sharepointtopics.blogspot.com/2008/07/domain-certificate-authority-signing.html

These are Administrator Approved Browser-enabled Forms, they must be uploaded in Central Administration.

Some things I try when getting this to upload:
There was no Submit sheesh, make submit option to "using rules"
Publish to a document library on the server.... oy vey its Admintrator Approved...
Changed submit options on and off, set verions higher, published to library, Published to library, uploaed. worked
Submit may not contain &...I took out the & shortcut key
Close all pages that show the form... not sure...
Switch off caching of data connections
Got to certificates, install to recommended, install to trusted certificates authority, then publish to moss, then file and upload...have since found that the code signing makes no difference
Took off submit, published to sharepoint library, then to network
Added digital certificate, published to sharePoint, then to network/file system
iisreset
reboot