Showing posts with label moss. Show all posts
Showing posts with label moss. Show all posts

Monday, July 13, 2009

Updating SPGroup owner

Hi

To update the owner of the group, you simply set the Owner property of the SPGroup object to a SPMember (which can be a SPUser or an SPGroup).

SPGroup spGroup = currentWeb.SiteGroups["GroupName"];
spGroup1.Owner = spGroup2;
sp.Group1.Update();

I was trying to update the owner of the SharePoint group through the API using the code above, but unfortunately that did not work.

So i did what most of the developers do, google it (i mean bing it). However i didn't find an answer to my question, so i tried to change my code and debug it until i found the solution.

For some reason, i had to get the reference to the SharePoint group from the root web of the site collection, rather than getting it from the web SiteGroups property.

so to fix the problem, i changed the above code to:
SPGroup spGroup = currentWeb.Site.RootWeb.SiteGroups["GroupName"];
spGroup1.Owner = spGroup2;
sp.Group1.Update();

I hope you will find this useful.




Tuesday, July 7, 2009

Anonymous access in SharePoint

Anonymous access in SharePoint can be configured on the lists level. This means that anonymous access can be setup to individual lists rather than an entire SharePoint site. It can be also turned on for an entire web site.

The anonymous access is enabled from the web application level first. ISA server (if available) will be also configured.

After a web application has been setup for anonymous access, individual web sites can be configured to enable anonymous access on them. By default, sites have their anonymous access turned off, and must be enabled by a site admin before non-authenticated users can access it. As mentioned earlier, this can also be set on individual lists and will be accessible by a direct link to the list.

MySite and Application pages
Unfortunately, with MOSS 2007, MySites cannot be accessible by anonymous users, and that’s because of the way that has been setup. To make them accessible to the outside users, some workarounds are needed. However, sub sites within MySite can be made accessible to outside users, but not the root MySite.

The Application pages (pages in the _Layouts folder) are also not accessible to the outside users. This includes the search default page. It is possible to solve these problems with some workarounds that involves custom developments.

Wednesday, May 20, 2009

Getting a SoapServerException after installing MOSS 2007 Service Pack 2

It appears that Service Pack 2 for MOSS 2007 has made some changes to the SharePoint Web Services in the way that it handles errors.

Today we noticed that the following error was being thrown from one of the List
ServicesException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
Before the Service pack was installed the exception was encapsulated within the XML returned by the method. After installing Service Pack 2 the method throws the exception and it must be caught by a try and catch statement.

This is how we used to handle the error

Service.Lists listsProxy = new Service.Lists();
listsProxy.Credentials = new NetworkCredential(sUser, sPassword, sDomain);
XmlNode ndReturn = listsProxy.UpdateListItems("ListName", xmlQuery);
if (ndReturn.InnerText.Contains("0x81020089")) {
return false;
}
return true

after applying the Service Pack, the code needed to be changed to

Service.Lists listsProxy = new Service.Lists();
listsProxy.Credentials = new NetworkCredential(sUser, sPassword, sDomain);
try {
XmlNode ndReturn = listsProxy.UpdateListItems("ListName", xmlQuery);
catch(Exception ex){
// do something
}
return true

Hope this helps

Wednesday, April 22, 2009

SharePoint site usage report or reports

SharePoint offers a way for web sites owners to view some statisticts about who is visiting thier site, which pages were accessed, and who is refering to thier site. These are called "Site Usage Reports" or "Site Usage Report" if you havn't enabled the MOSS Standard site features.

All the documentations that describe the process of enabling the "Site Usage Reports" fail to mention that you need to enable the "Office SharePoint Server Standard Site features" on the site to get the advanced statistics.

You will need to enable this feature so you can display some more advanced statistics about the site, as shown in the picture.

It took me a while to figure out why some of my sites were displaying these advanced reports and some weren't.

The advanced reports page has the following url:
~/_layouts/SpUsageSite.aspx
while the normal usage reports has
~/_layouts/UsageDetails.aspx

At the moment, I'm having a problem with displaying the data in the advanced usage reports, however, the normal reports succeeds in displaying them.

References: