AWG Blogs

Sunday, March 18, 2012

Force Post in .load method

The following code:
may produce the error in the Response as visible from the Console tab of Firebug: "Request format is unrecognized for URL unexpectedly ending in '/HelloWorld'."

This ASP.NET web service expects a POST. To force a POST change the code by adding a bogus object to the .load jQuery method:

Update: Actual fix is to edit the web.config, see comment by Lotas here.

Monday, March 12, 2012

Setting Theme in Feature Receiver

When provisioning web sites, the theme was not taking. To get it working I made the following change to RestoreWebProperties, which was generated by SharePoint Solution Generator.

string key = xWebProperty.Attributes["Key"].Value;
string value = xWebProperty.Attributes["Value"].Value;
//this does not work for __IncludeSubSitesInNavigation, use AllProperties instead
/* if (web.Properties.ContainsKey(key))
web.Properties[key] = value;
web.Properties.Add(key, value);
} */
//need explicit set, apparently setting via property bag does not effect update
if (key == "vti_themedefault")
catch { }

web.AllProperties[key] = value;


Note, get the theme key from TemplateID element in SPTHEMES.XML. Also do web.Update() instead of web.Properties.Update().

Friday, March 9, 2012

TFS Project Folders and Workspaces

In Source Control Explorer, one way to map separate folders to separate local paths, perhaps on a separate drive e.g., is to use Workspaces.

Do File, Source Control, Workspaces, Add Workspace. Name the Workspace as appropriate, e.g. "My Projects." Select the TFS project folder, and the corresponding Local folder. Click OK.

This way you can separate your local files on a separate local root folder, (e.g. c:\My Projects") from folders other team members own (e.g. mapping of c:\Other projects).