Missing settings ak menu items in SharePoint 2007 Site Actions Menu
After a SharePoint update (Cummulative Update) I was facing problems with my Site Actions Button. I missed some items as: create and site settings. It was not a security issue since I could load the pages manually by typing the url (e.g. /_layouts/settings.aspx) and I'm in the role of Site Collection Administration.
I faced that my sitecollection was made readonly. This issue could be solved by code or by stsadm.exe
You can change it via code:
Microsoft.SharePoint.Administration.SPSiteAdministration siteAdministration = new SPSiteAdministration(siteCollectionUrl);
siteAdministration.ReadOnly = true;
siteAdministration.Dispose();
Or to remove all locks to the site via STSADM:
stsadm -o setsitelock -url http://servername -lock none
Commerce Server 2009 installation on Windows 2008R2 workaround
Since the installer will fail if you try to install Microsoft Commerce Server 2009 on Windows 2008 R2 you have to use the next workaround since the .NET Framework 3.5 SP1 is not recognized:
- Manually add the next registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\Microsoft .NET Framework 3.5 SP1\KB953595
It's only a workaround please wait to the official release to address win2k8 R2 support.
VSeWSS error - the response message does not match the content type
I got the following error trying to build a project of the WSS extensions for Visual Studio 1.3
You can fix it by: Add / Remove Programs and add HTTP Activation. Here's the step by step: Use Turn Windows Features On and Off in the control panel, then locate .NET Framework 3.5 and then find Windows Communication Foundation HTTP Activation. Select it and choose.
Exception - One or more field types are not installed properly
After debugging my code it seemed to be an error in my CAML query. An interesting field in my CAML was the "Start Time" of the Event List (e.g. used in combination with calender view). I used it as:
<OrderBy><FieldRef Name='Start Time' /></OrderBy><Where>
I remembered the trick with replacing the spaces in CAML so I changed my query in:
<OrderBy><FieldRef Name='Start_x0020_Time' /></OrderBy><Where>
Still the same error
. I decided to open the U2U Caml Query Builder (http://www.u2u.info/SharePoint/U2U%20Community%20Tools/Forms/AllItems.aspx) to check my query. Then there was the "aha" moment. The internal field name of the field Start Date is: "EventDate". After changing the caml code again it worked!
<OrderBy><FieldRef Name='EventDate' /></OrderBy><Where>
Lesson learned: U2U Caml Query builder is a must have and the internal name may be totaly different from the display name. If you have the same "aha" moment, feel free to leave a comment.
RSS Web Part on Publishing Page
During trying to add a standard RSS Web Part on my publishing page I came accross some issues.
1) The RSS WebPart was not visible in the WebPart gallery. This could be solved by enabling the Office Server Enterprise Site Collection Features (if you have an Enterprise license).
2) After adding a RSS-Url in the Web Part properties I got the next error:
3) The SharePoint Log says: "RssWebPart: Exception handed to HandleRuntimeException.HandleException System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable host". Since I use this WebPart on a server containing a Proxy, I modified the web.config.
<system.net>
<defaultProxy>
<proxy autoDetect="true" proxyaddress="http://YOURPROXYSERVER" bypassonlocal="true" />
</defaultProxy>
</system.net>
[/code]
4) After modifying the web.config I got the next error (this looks like trial on error).
The SharePoint log says: "RssWebPart: Exception handed to HandleRuntimeException.HandleException System.Net.WebException: The remote server returned an error: (400) Bad Request. at Microsoft.SharePoint.WebControls.BaseXmlDataSource.GetXmlDocument() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetHierarchicalDocument(IHierarchicalDataSource ds) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetHierarchicalXPathNavigator(IHierarchicalDataSource ds) at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal() at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator() at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator(IDataSource datasource, Boolean originalData) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXPathN..."
One of the scenarios when "400 Bad Request" is returned is if the value of the content-length header is smaller then the actual length of the message body.
Note: After adding a Page Viewer Web Part and setting the url to the RSS url I get the xml back...
5) After changing the proxy "again" in the web.config it works fine
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy usesystemdefault="false" proxyaddress="http://yourserver:yourport" bypassonlocal="false" />
</defaultProxy>
</system.net>
6) The result:
Problem - Dynamic Load Webservice
After reading this mailthread on MSDN it seems to be possible to dynamically load a webservice (load on demand). However I got the following error on this line of code:
Object response = methodInfo.Invoke(obj, args);
[/code]
Also this tool on CodePlex causes the same error on the same line. Click on the image below for a screenshot of the error.
Since I get this error in a environment with a domain logon account I tried the following Credentials:
// method 1
webRequest.PreAuthenticate = true;
webRequest.Credentials = new NetworkCredential("username, "password", "domain");
// method 2
System.Net.CredentialCache.DefaultCredentials;
[/code]
All code is executed correctly. If it was really an authentication error I wasn't inpossible to read the webservice stream (in my opinion). So it seems I'm well authenticated.
Is there someone who get this working or have an alternative?
Thanks!!
Log Exceptions to Default SharePoint LogFile
It's possible to log exceptions using the next codesnippet (MOSS Only). Advantage: exceptions are logged to a single file (i.e. in the 12 hive under the LOGS directory). No extra dll’s are needed to be installed. The only limitation to using the MOSS logger is that you cannot set the log event level e.g. critical, high, medium, low it will always display the error level as high.
catch(Exception myException)
{
Microsoft.Office.Server.Diagnostics.PortalLog.LogString(”Exception
Occurred: {0} || {1}”, myException.Message, myException.StackTrace);
}
The MOSS logger is located in the Microsoft.Office.Server.dll and therefore it is only available with the MOSS install, not WSS 3.0. For more control and flexibility use the Enterprise library logger.
Problems using WSS Extensions for Visual Studio
ERROR: “This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name.” when deploying a solution using the Visual Studio Extensions for SharePoint (VSEWSS) after you have already deployed it to a different site on the same server.
Resolution:
- Remove the solution’s assembly from the Global Assembly Cache (GAC).
- Gacutil –uf assemblyName (note: no .dll extension is specified)
- Rename or Remove the feature from “Program Files\Common Files\Microsoft Shared\
web server extensions\TEMPLATE\FEATURES\FeatureName”
//FeatureName may not be the same as assembly name –
look in your manifest.xml to find the correct name
[/code]
ERROR: When trying to deploy a VSEWSS solution using the Visual Studio “Deploy” command you receive the error “Value does not fall within the expected range.”
Resolution:
Remove all projects except the VSEWSS project from the Visual Studio solution
then attempt your deployment again.
ERROR: Value does not fall within the expected range (Line 0, Column 0)
Resolution:
- Delete the pkg folder in your solution foler.
- Start building and deploying again.
Read More on MSDN Forum
Registering ASP.NET on IIS after installing the .NET Framework
After installing the .NET-Framework we can register it by using
the commandline: C:\Windows\Microsoft.Net\Framework\vx.y.zz\aspnet_regiis.exe
-i
Setting a custom masterpage and css using a feature without invalid cast exception
A lot of people have problems casting the SPSite to SPWeb, they are trying to do something like: SPWeb CurrentWeb = (SPWeb)properties.Feature.Parent. By trying this you get a invalid cast exception. Some people are trying to do it in one step and get a nullreference to the object. In the next lines you can find the right way to set a custom masterpage and css using a feature.
[code:c#]
// Don't forget to inherit your class from SPFeatureReceiver!
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
using (SPSite CurrentSite = properties.Feature.Parent as SPSite)
{
if (CurrentSite != null)
{
SPWeb CurrentWeb = CurrentSite.RootWeb;
CurrentWeb.MasterUrl = "/_catalogs/masterpage/custom.master";
CurrentWeb.CustomMasterUrl = "/_catalogs/masterpage/custom.master";
//In a publishing site the css is saved in the Style Library
CurrentWeb.AlternateCssUrl = "/Style Library/custom.css";
CurrentWeb.Update();
}
}
}
// Set it back to default
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
using (SPSite CurrentSite = properties.Feature.Parent as SPSite)
{
if (CurrentSite != null)
{
SPWeb CurrentWeb = CurrentSite.RootWeb;
CurrentWeb.MasterUrl = "/_catalogs/masterpage/default.master";
CurrentWeb.CustomMasterUrl = "/_catalogs/masterpage/default.master";
CurrentWeb.AlternateCssUrl = "";
CurrentWeb.Update();
}
}
}
[/code]