Thursday, July 23, 2009

How to change SQL server name ?

A very common issue, when you make a p2v ( convert in vmare language ) to a physical Server and change the name of the server.

The whole idea is that the database still thinks it's on the pervious database and it damages his functionalty.

Those are the steps to check if you have this issue, and how to fix that.

 
//check the hosting server of the SQL service
sp_helpserver
select @@servername

//if the server name that appears is of the pervious server
// Make sure to run it from the server itself, NO remote execution
sp_dropserver 'old_name'
go
sp_addserver 'new_name','local'
go
// Now restart the SQL service and check the first step again to make sure.


Good luck

Thursday, July 2, 2009

Archive for Sharepoint ? Symantec Enterprise Vault... Round# 2

Well, a while ago I talked about the Enterprise vault product for archiving Sharepoint platform.
Since then, The Moss 2007 is common in every single customre I have. So , now they have new version. I checked. And now I declare.

What did they fix that makes it better than their last version ?

1. It supports Kerberos authentication.

What still makes it not ready ?

1. Doesn't support fedrated shearch AKA you still cant crawl it with your Moss search engine.
2. When you want to edit an item, it's being retrieved back from the repository, but it opens the document in your temporray internet files and NOT in your web site AKA your changes wont be saved/updated ( Cause you didn't save them on your website ).
3. Permission issue. When you copy an item ( the stub ) to anoter new list with diffrent ACL - you wont be able to reach the file if you dont have an access to the source list ( read at least ).

There are more issues, but those are the most critical and I count only till three.

Sorry, But it still not ready. I better submit my customer an email.

Sunday, June 21, 2009

How to Delete specific user from your sharepoint sites

Hey.

Small task I had today, to delete a certain user who left the company. They have a list in which they document all the workers who left, so I had to just check the list every day, see if there is anything new and if so, just delete that user from all SiteCollection - be aware, when you delete a user from the siteCollection it's enough, there is no need to drill down to each and each web site.

 


foreach (SPWebApplication webApp in service.WebApplications)
{
SPSiteCollection colSites = webApp.Sites;
for (int i = 0; i < colSites.Count; i++)
{
using (SPWeb web = colSites[i].OpenWeb())
{
SPUser user = web.SiteUsers[UserName_ToDelete];

try
{
if (!user.IsDomainGroup && !user.IsSiteAdmin)
{
web.SiteUsers.Remove(user.LoginName);
web.Update();
}
}
catch (Exception ex)
{
// user not found
}
}
colSites[i].Dispose();
}

}

Wednesday, May 27, 2009

SP2 is out - But with some "minor" problems...

Be aware for the bug when installing the SP. There is a simple workaround, an hotfix soon to be released.

http://blogs.msdn.com/sharepoint/archive/2009/04/28/announcing-service-pack-2-for-office-sharepoint-server-2007-and-windows-sharepoint-services-3-0.aspx

Sunday, May 17, 2009

SPUserCollection is not including groups ? Or just a Bug in Wss 2.0 Object Model ?

Hey.

I wrote today a small application that need to track down all the administrators of all the websites in my client sharepoint farm ( and write the data into a list with the website url and etc ).

Anyway , just to remind you I was dealing with wss 2.0 ( 2003 ), I was doing very simple stuff as iterating via all web applications->SiteCollections->WebSites.
and then just wanted to get all the users ( including Active directory groups )

 
SPUserCollection colUser = web.AllUsers;
foreach(SPUser user in colUser)
{
// check if admin, update list and blah blah
}


Unfortunately, it gives you back only the regular users, and not the AD groups too. I know you have under the SPWeb object the groups/sitegroups property but both of them are for Sharepoint groups and not for AD group.
Moreover, Under the SPUser object you have the property IsDomainGroup ( like I cant ask for more ) - BUT sorry, it just gives you back regular users all the time, and just "ignore" the AD gorups.

What I did at the end ? Just made a query to the SQL table ( Not so good, cause It's not supported ) - I will try now with WebService, let's hope it work via that.

If you think i'm wrong or you have another idea. Please comment.

Friday, April 3, 2009

SPQuery operators

I dont why in the Moss SDK there is no list of the operators in the SPQuery class.

It's kind of handy to have them by when you build your query.

Eq = equal to

Neq = not equal to

Lt = less than

Leq = less than or equal to

Gt = greater than

Geq = greater than or equal to

BeginsWith = begins with

Contains = contains

IsNull = is null

IsNotNull = is not null


Hopes it helps.

Sunday, March 15, 2009

Site Templates

I was asked to create several sites automatically, i had two options rather made it via stsadm or via the object model.

but first I had to look for the web sites templates identifiers -

GLOBAL#0 = Global template
STS#0 = Team Site
STS#1 = Blank Site
STS#2 = Document Workspace
MPS#0 = Basic Meeting Workspace
MPS#1 = Blank Meeting Workspace
MPS#2 = Decision Meeting Workspace
MPS#3 = Social Meeting Workspace
MPS#4 = Multipage Meeting Workspace
CENTRALADMIN#0 = Central Admin Site
WIKI#0 = Wiki Site
BLOG#0 = Blog
BDR#0 = Document Center
OFFILE#0 = Records Center
OFFILE#1 = Records Center
OSRV#0 = Shared Services Administration Site
SPS#0 = SharePoint Portal Server Site
SPSPERS#0 = SharePoint Portal Server Personal Space
SPSMSITE#0 = Personalization Site
SPSTOC#0 = Contents area Template
SPSTOPIC#0 = Topic area template
SPSNEWS#0 = News Site
CMSPUBLISHING#0 = Publishing Site
BLANKINTERNET#0 = Publishing Site
BLANKINTERNET#1 = Press Releases Site
BLANKINTERNET#2 = Publishing Site with Workflow
SPSNHOME#0 = News Site SPSSITES#0 = Site Directory
SPSCOMMU#0 = Community area template
SPSREPORTCENTER#0 = Report Center
SPSPORTAL#0 = Collaboration Portal
SRCHCEN#0 = Search Center with Tabs
PROFILES#0 = Profiles
BLANKINTERNETCONTAINER#0 = Publishing Portal
SPSMSITEHOST#0 = My Site Host
SRCHCENTERLITE#0 = Search Center
SRCHCENTERLITE#1 = Search Center
SPSBWEB#0 = SharePoint Portal Server BucketWeb Template