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

Hello,

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()

        Try

            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, _
            sendAs)

        userSecurity.AddAccessRule(allowSendAs)
        user.CommitChanges()

    End Sub

### End Code ###

Thanks is advance for your help.
Ron_MonteclavoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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?
0
CodeCruiserCommented:
Does the user executing the code have admin permissions?

If you use powershell, does it work?

http://arnoutvandervorst.blogspot.com/2008/03/powershell-add-and-remove-send-as.html
0
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.
0
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.