Dear Sirs,

I would like to run the below code using other credentials than the user
running it, how can I use different credentials?

Thank you,
Yahya

Dim msgobj

msgobj = CreateObject("CDO.Message")

msgobj.DataSource.Open(sUrl, , 3)

If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
msgobj.fields("DAV:contentclass").value = "urn:content-classes:message" Then

msgobj.attachments.deleteall()

msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"

msgobj.fields.update()

msgobj.DataSource.Save()

End If

msgobj = Nothing

Re: With different credentials. by Pipo

Pipo
Mon Apr 04 09:22:45 CDT 2005

Yahya,

Check if the
WindowsIdentity.Impersonate Method
Allows code to impersonate a different Windows user is what you're looking
for

"Yahya" <x@x.x> wrote in message
news:O25epoROFHA.3400@TK2MSFTNGP10.phx.gbl...
> Dear Sirs,
>
> I would like to run the below code using other credentials than the
user
> running it, how can I use different credentials?
>
> Thank you,
> Yahya
>
> Dim msgobj
>
> msgobj = CreateObject("CDO.Message")
>
> msgobj.DataSource.Open(sUrl, , 3)
>
> If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
> msgobj.fields("DAV:contentclass").value = "urn:content-classes:message"
Then
>
> msgobj.attachments.deleteall()
>
> msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"
>
> msgobj.fields.update()
>
> msgobj.DataSource.Save()
>
> End If
>
> msgobj = Nothing
>
>
>
>



Re: With different credentials. by Steve

Steve
Mon Apr 04 12:44:44 CDT 2005

You can use impersonation to have ASP.NET run under a different user
account.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyUserName">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetimpersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Yahya" <x@x.x> wrote in message
news:O25epoROFHA.3400@TK2MSFTNGP10.phx.gbl...
> Dear Sirs,
>
> I would like to run the below code using other credentials than the
> user
> running it, how can I use different credentials?
>
> Thank you,
> Yahya
>
> Dim msgobj
>
> msgobj = CreateObject("CDO.Message")
>
> msgobj.DataSource.Open(sUrl, , 3)
>
> If msgobj.fields("urn:schemas:httpmail:hasattachment").value = True And
> msgobj.fields("DAV:contentclass").value = "urn:content-classes:message"
> Then
>
> msgobj.attachments.deleteall()
>
> msgobj.fields("urn:schemas:mailheader:keywords").value = "Attachment"
>
> msgobj.fields.update()
>
> msgobj.DataSource.Save()
>
> End If
>
> msgobj = Nothing
>
>
>
>