Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SharePoint > SharePoint Development
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SharePoint Development Programming and development for SharePoint Portal Server and Windows SharePoint Services
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SharePoint Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2007, 09:07 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Needed help in Sharepoint.

Hi,

I have inherited a sharepoint web part from dotnet Asp.net 2.0 that is
displaying task list in MOSS site. It calls FindAll() to locate a specific security
group, and then enumerates through the group to retrieve the user's
display names.

*Very* intermittently this web part will throw an exception - either
"System.Runtime.InteropServices.COMException: The server is not operational" or,
 sometimes, "The authentication mechanism is
unknown". When I say intermittently, I mean very intermittently - it is
fine 60% of the time. There doesn't seem to be any pattern to the
errors .
I am really hoping someone can help, this is proving very difficult to
fix as it is so irregular.


Code

 private DirectorySearcher GetDirectoryObject()
        {
            DirectoryEntry oDE = new DirectoryEntry("LDAP://MYDOMAIN", "username", "pwd", AuthenticationTypes.Secure);
            DirectorySearcher deSearch = new DirectorySearcher();
            deSearch.SearchRoot = oDE;
            return deSearch;
        }

        public string GetProperty(SearchResult searchResult, string PropertyName)
        {
            if (searchResult.Properties.Contains(PropertyName))
            {
                return searchResult.Properties[PropertyName][0].ToString();
            }
            else
            {
                return string.Empty;
            }
        }


        public string GetDept(string username)
        {

            DirectorySearcher deSearch = GetDirectoryObject();
            deSearch.Filter = "(&(objectClass=user)(SAMAccountName=" + username + "))";
            deSearch.SearchScope = SearchScope.Subtree;
            string UserDept = "";
            foreach (SearchResult results in deSearch.FindAll())
            {
                UserDept = GetProperty(results, "userPrincipalName");

            }

            return UserDept;
        }

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharepoint ramamurthi_c SharePoint Development 1 December 11th, 2009 07:01 PM
Need help getting started - Sharepoint ender165 BOOK: Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 ISBN: 978-0-470-12449-9 2 May 14th, 2008 12:53 PM
Sharepoint Jayarajmrj SQL Server 2000 1 July 30th, 2007 10:16 PM
WinForm and Sharepoint natarajan_ve .NET Web Services 0 July 28th, 2005 05:35 AM



All times are GMT -4. The time now is 07:38 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.