[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3349
  • Last Modified:

The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)


I am working on some code in vb.net that should allow me to add the Send As permissions to a user for a certain security group.  Below is the code I am using, however, I am getting the following error once it tries to commit the changes:

The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)

#### Start Code ####

    Protected Sub GrantSendAs()


            Dim search1 As SearchResult = appFuncs.GetObjectOne("(&(objectClass=user)(mail=*)(displayname=" & ddlMatchingUsers.SelectedValue.ToString & "))")
            Dim search2 As SearchResult = appFuncs.GetObjectOne("(&(objectClass=group)(samaccountname=DSO_ADC))")
            Dim trustee As New SecurityIdentifier(CType(search2.Properties("objectSid")(0), Byte()), 0)
            Dim user As DirectoryEntry = search1.GetDirectoryEntry

            SetSendAsPerms(user, trustee)

            appSubs.WriteEventApp(Context.User.Identity.Name, "BBUserAdmin", "GrantSendAs", _
                lblADsamaccountname.Text, "Send As permissions have been granted on the user, ticket#: " & txtClarifyTicket.Text & ".")

        Catch ex As Exception

            ShowError("CRITICAL ERROR encountered while granting send as permissions: " & ex.Message)
            appSubs.WriteEventSystem(Context.User.Identity.Name, "BBUserAdmin", "GrantSendAs", ex.Message)

        End Try

    End Sub

     Protected Sub SetSendAsPerms(ByVal user As DirectoryEntry, ByVal trustee As SecurityIdentifier)

        Dim sendAs As New Guid("{AB721A53-1E2F-11D0-9819-00AA0040529B}")
        Dim userSecurity As ActiveDirectorySecurity = user.ObjectSecurity

        Dim allowSendAs As New ActiveDirectoryAccessRule(trustee, _
            ActiveDirectoryRights.ExtendedRight, _
            AccessControlType.Allow, _


    End Sub

### End Code ###

Thanks is advance for your help.
  • 3
  • 2
1 Solution
Ron_MonteclavoAuthor Commented:
Unfortunately, those issues deal with a password problem.  This user is already created and active, I am just trying to assign the SendAS permission on the user account for another group.  Just to be sure, I did verify that the user is enabled, not locked out, and the password meets the criteria.
Is it possible I am not assigning the directory entry correctly?
Does the user executing the code have admin permissions?

If you use powershell, does it work?

Ron_MonteclavoAuthor Commented:
As a little extra background, this is running from a website, however, the service account used as the identity of the web site process does have the rights.  I confirmed the rights of the service account to be sure by running our vbscript that performs this function under it's credentials and was able to assign the rights without any issues.
Ron_MonteclavoAuthor Commented:
This has been resolved, I have recently reloaded my workstation due to a crash and once the client was re-installed it was once again working and I am able to connect to the host.  I am unable to identify what the actual cause was still for the problem.

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now