Tuesday, August 24, 2010

Add Active Directory Users to SharePoint Group

string loginName = null;


string loginEmail = null;

SPSite thisSite = null;

SPWeb thisWeb = null;

SPGroup thisGroup = null;

DirectoryEntry user = null;



DirectoryEntry directoryEntry = new DirectoryEntry(ldap://yourdomain/);

DirectorySearcher ds = new DirectorySearcher(directoryEntry);

ds.Filter = "(&(objectClass=group)(cn=yourgroup))";



object groupMembers = ds.FindOne().GetDirectoryEntry().Invoke("Members", null);

foreach (object groupMember in (IEnumerable)groupMembers)

{

user = new DirectoryEntry(groupMember);

if (!(user.Properties["sAMAccountName"].Value == null))

{

loginName = user.Properties["sAMAccountName"].Value.ToString();

}



if (!(user.Properties["mail"].Value == null))

{

loginEmail = user.Properties["mail"].Value.ToString();

}



string userName = user.Name.Remove(0, 3).Replace("\\", "");





thisSite = new SPSite("http://yoursite");

thisWeb = thisSite.OpenWeb();

thisGroup = thisWeb.SiteGroups["yourgroup"];

try

{



if (thisGroup.Users["yourdomain\\" + loginName].LoginName.ToString() == loginName) { }

}

catch

{

thisGroup.AddUser("yourdomain" + loginName, loginEmail, userName, "Added by System.");

}

}

thisWeb.Dispose();

thisSite.Dispose();

user.Dispose();

ds.Dispose();

Tuesday, February 23, 2010

SharePoint and SSRS

Out of nowhere it seems a very stable and performing MOSS 2007 and SSRS 2005 environmnet completely bombed!! Ok maybe not out of nowhere, after completing a migration of our MOSS environment from one SQL Server to another our Integrated MOSS 2007 and SSRS environment quit delivering reports. Where we once had reports we now had the below error message:

An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for data set 'YourDataset'. (rsErrorExecutingCommand)
Failed to execute web request for the specified URL. (rsXmlDataProviderError)


 
We immediately went into trouble-shooting mode and begin retracing the steps the bring our new environment up to standards where the old environment was. This included web part installs and configuration changes. After all of this still no reports from MOSS!!

 This post is half gripe and complain and half helpful tips on integrating MOSS and SSRS.

There are many useful links when it comes to integrating SSRS with MOSS. I followed the ones available on TechNet and SharePoint and SQL Server Reporting Services - Installation and Setup. These seem to be the most straight forward I found during our initial deployment.

Of course during our migration/restoration "We knew exactly what we did the 1st time" so we just did the same thing again. And we all know how well that usually winds up.  With the above error and users complaining that the reports are down!!

Well after much time and headache we decided to retrace the steps following the above mentioned blogs step by step.  In the blogs one part that is mentioned briefly and probably not stressed as much as necessary is the need for MOSS site you are pulling data from the have Kerberos as the default Authentication Method!!  You can set this by navigating to Central Administration on your MOSS server > Application Management > Select your Web Application > under the Application Security section > Authentication Providers > default zone > check Integrated Windows Authentication > Negotiate (Kerberos) > Save.



This simple change totally resolved our issues.  Of course this leads into Kerberos Authentication for your MOSS Environment and the SPN's that go with it but we will save that for another post!!

I hope this will save someone out there a little time and trouble!!

Thursday, November 5, 2009

SHAREPOINT AAAAAARRRRGH

from one issue to the next it seems that lack of communication across IT is causing multiple issues for multiple teams. however the upstream system is the face of the application so guess who gets the damn heat!! back to another challenging day!

Wednesday, November 4, 2009

FaceBook and Your Blog

good article on linking your blog to your fb page...i am trying to get one central location for all of my damn social media and networking sites...please let it not be this damn difficult!!

http://www.askdavetaylor.com/how_do_i_import_my_blog_entries_or_rss_feed_into_facebook.html

nice media site for the boys!!

i am a die hard cowboys fan...so just sharing one of the best media sites of an nfl team.

SP Folder Custom Views

was able to satisfy me req with ordering and sorting but thought this was a nifty work around so wanted to give some props!

http://www.endusersharepoint.com/2009/01/14/automatically-switching-views-when-opening-a-sharepoint-folder/

SharePoint Alerts

fighting an issue with sharepoint daily alerts not being delivered to users. running through all the damn stsadm commands and all settings look right to me. if i find a solution i will post it here or on twitter for sure.