Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6357185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:06:58+00:00 2026-05-24T23:06:58+00:00

I have a little code to delete a security group from Active Directory, but

  • 0

I have a little code to delete a security group from Active Directory, but when run, I get a COMException with the message “Unspecified error”.

Here is the code:

public void DeleteGroup(Model.Asset pADSecurityGroup)
{
    using(DirectoryEntry ou = new DirectoryEntry(pADSecurityGroup.Organization.ActiveDirectoryMappings.Single().Identifier))
    using(DirectoryEntry group = new DirectoryEntry("LDAP://" + pADSecurityGroup.ActiveDirectoryMappings.Single().Identifier))
    {
        ou.Children.Remove(group);
        group.CommitChanges();
    }
}

And here’s the message in the Windows Event Console:

Event code: 3005 
Event message: An unhandled exception has occurred.
Event time: 8/23/2011 11:29:35 AM  
Event time (UTC): 8/23/2011 5:29:35 PM  
Event ID: 67e6356c9ff146c7a0d9024350cbb3a0  
Event sequence: 79  
Event occurrence: 1  
Event detail code: 0

Application information: 
    Application domain: /LM/W3SVC/1/ROOT-2-129585938920392018 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\vo\Web\Portal\ 
    Machine name: TR-2K8-001    Process information: 
    Process ID: 8348 
    Process name: w3wp.exe 
    Account name: VO\treed    Exception information: 
    Exception type: COMException 
    Exception message: Unspecified error

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_IsContainer()
   at System.DirectoryServices.DirectoryEntries.Remove(DirectoryEntry entry)
   at VirtualOffice.DirectoryServices.Impl.DirectoryService.DeleteGroup(ResourcePool pResourcePool) in C:\inetpub\wwwroot\vo\Common Libraries\VirtualOffice.DirectoryServices\Impl\DirectoryService.cs:line 249
   at VirtualOffice.Controllers.ResourcePoolController.Delete(Int32 pServiceProviderId) in C:\inetpub\wwwroot\vo\Common Libraries\VirtualOffice.Controllers\ResourcePoolController.cs:line 171
   at Organization_ResourcePools.rtbResourcePools_OnButtonClick(Object sender, RadToolBarEventArgs e) in c:\inetpub\wwwroot\vo\Web\Portal\Organization\ResourcePools.aspx.cs:line 85
   at Telerik.Web.UI.RadToolBar.OnButtonClick(RadToolBarEventArgs e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Request information: 
    Request URL: https://localhost:443/Organization/ResourcePools.aspx

    Request path: /Organization/ResourcePools.aspx 
    User host address: ::1 
    User: Portal Admin 
    Is authenticated: True 
    Authentication Type: Federation 
    Thread account name: VO\treed    Thread information: 
    Thread ID: 5 
    Thread account name: VO\treed 
    Is impersonating: False 
    Stack trace:

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_IsContainer()
   at System.DirectoryServices.DirectoryEntries.Remove(DirectoryEntry entry)
   at VirtualOffice.DirectoryServices.Impl.DirectoryService.DeleteGroup(ResourcePool pResourcePool) in C:\inetpub\wwwroot\vo\Common Libraries\VirtualOffice.DirectoryServices\Impl\DirectoryService.cs:line 249
   at VirtualOffice.Controllers.ResourcePoolController.Delete(Int32 pServiceProviderId) in C:\inetpub\wwwroot\vo\Common Libraries\VirtualOffice.Controllers\ResourcePoolController.cs:line 171
   at Organization_ResourcePools.rtbResourcePools_OnButtonClick(Object sender, RadToolBarEventArgs e) in c:\inetpub\wwwroot\vo\Web\Portal\Organization\ResourcePools.aspx.cs:line 85
   at Telerik.Web.UI.RadToolBar.OnButtonClick(RadToolBarEventArgs e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Custom event details:
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:06:58+00:00Added an answer on May 24, 2026 at 11:06 pm

    Based on the questions/answer in the comments section I revise my answer.
    I think you simply forgot the LDAP protocol identifier for the LDAP path of your organization unit. I think, unspecified error means invalid LDAP path.

    Try the following code:

    public void DeleteGroup(Model.Asset pAsset) 
    { 
      using(DirectoryEntry ou = new DirectoryEntry("LDAP://" + pResourcePool.Organization.ActiveDirectoryMappings.Single().Identifier)) 
      {
        using(DirectoryEntry group = new DirectoryEntry("LDAP://" + pResourcePool.ActiveDirectoryMappings.Single().Identifier), username, userpwd) 
        { 
        ou.Children.Remove(group); 
        group.CommitChanges(); 
        } 
      }
    } 
    

    By the same token, ensure that the LDAP protocol identifier is written using capital letters.
    Hope, this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have updated my code a little, but I am still not exactly
With more than a little help from daviderossi.blogspot.com I have managed to get some
I have a simple little code fragment that is frustrating me: HashSet<long> groupUIDs =
I have a little private Google code project. For a SCM I use Mercurial.
I have a little piece of rails code which lets users enter a review.
I have a little bit of Javascript that almost works correctly. Here's the code:
Our website code is written in PHP. We have very little testing in regards
I have a bunch of these little bits of HTML code repeated over and
its a little bit hard to understand. in the header.php i have this code:
I have little knowledge of Flash but for a little Flash game I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.