Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Need help in Sharepoint


Need help in Sharepoint

Reply
  #1 (permalink)  
Old 09-13-07, 10:18 AM
subhasps8 subhasps8 is offline
Newbie Coder
 
Join Date: Jun 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Question Need 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
csharp Code:
  1. private DirectorySearcher GetDirectoryObject()
  2.         {
  3.             DirectoryEntry oDE = new DirectoryEntry("LDAP://MYDOMAIN", "username", "pwd", AuthenticationTypes.Secure);
  4.             DirectorySearcher deSearch = new DirectorySearcher();
  5.             deSearch.SearchRoot = oDE;
  6.             return deSearch;
  7.         }
  8.        
  9.         public string GetProperty(SearchResult searchResult, string PropertyName)
  10.         {
  11.             if (searchResult.Properties.Contains(PropertyName))
  12.             {
  13.                 return searchResult.Properties[PropertyName][0].ToString();
  14.             }
  15.             else
  16.             {
  17.                 return string.Empty;
  18.             }
  19.         }
  20.  
  21.        
  22.         public string GetDept(string username)
  23.         {
  24.  
  25.             DirectorySearcher deSearch = GetDirectoryObject();
  26.             deSearch.Filter = "(&(objectClass=user)(SAMAccountName=" + username + "))";
  27.             deSearch.SearchScope = SearchScope.Subtree;
  28.             string UserDept = "";
  29.             foreach (SearchResult results in deSearch.FindAll())
  30.             {
  31.                 UserDept = GetProperty(results, "userPrincipalName");
  32.  
  33.             }
  34.  
  35.             return UserDept;
  36.         }

Last edited by koncept; 09-13-07 at 03:51 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-13-07, 03:50 PM
koncept
Guest
 
Posts: n/a
i wish i could offer some advice, but i dont know anything about share point. have you checked the server event log. it might have more detail..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-14-07, 09:16 PM
FreelanceMan FreelanceMan is offline
Newbie Coder
 
Join Date: Sep 2007
Location: Atlanta, GA
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Let me hazard a guess: what we're seeing isn't really the actual code that's failing. I want to know more about where you get "username" from. Clearly you're not hardcoding it, since that would be a bad idea. Everything I've read on this so far indicates that it nothing to do with Sharepoint and everything to do with creating a good connection to AD.

Hope the hint helps.
__________________
FreelanceLocalTech.com - Free Directory of Freelance Consultants - Are You In It?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Output File to windows machine tobyjoiner PHP 12 01-18-07 02:14 PM
CMS or Sharepoint M I L A N I The Lounge 2 08-30-06 07:04 AM
Script like MS SharePoint? Zing Queen Script Requests 0 07-22-03 11:56 PM


All times are GMT -5. The time now is 12:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.