C# - Retrieving Mailbox Rights From AD Using System.DirectoryServices

Jun 3, 2011

I need to pull back the security descriptors for the active directory attribute "msExchMailboxSecurityDescriptor" on user account objects.So far, all I can find is that I need to use this class to do so, but I cannot find any example code of how to start to pull what I want out using it.I'm restricted to using .Net v2.0.

View 1 Replies


ADVERTISEMENT

A First Chance Exception Of Type 'System.UnauthorizedAccessException' Occurred In System.DirectoryServices.dll

Dec 16, 2010

I would like to create a local user on a windows 7 PC, but gets the following error when commitchanges runs. I am administrator on the PC:

A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.DirectoryServices.dll

Here is my code:

CODE:

I am using Visual Basic 2010 ultimate in Visual Studio 2010.

View 4 Replies

Can't Add Reference System.directoryservices

May 21, 2012

I'm upgrading my site and pasted some code into a new form in VS 2011 Express beta. I get the standard error below: Namespace or type specified in the Imports 'System.DirectoryServices' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

I went ahead and added a reference for system.directoryservices. Still, the errors remain. I go back to references to make sure it's been added, and it is no longer checked. Repeated tries and the same results.

View 4 Replies

System.directoryservices And ActiveDirectorySecurity?

May 8, 2009

I've read through what little I could find on system.directoryservices and setting object permissions in AD.What I need to do is grab a DE, read its security descriptor and add / modify it. I need to add permission to another user.

I know how to use the CACLS command for the file system and the concept is basically the same but I dont see any VB (or any ) examples out there that could show me how to grab a distribution list AD object and modify the descriptor so the user has permissions to update the DL (without actually being the owner).

View 1 Replies

C# - Add A User To AD Using System.DirectoryServices.AccountManagement?

May 26, 2009

Using the .net 3.5 framework and C# I'm trying to add a new user to AD from C# and can't find any examples. I see that the PrincipalCollection object has an overloaded 'add' method but can't seem to figure out how it works. Can anyone help?

How create a new user object, add it into AD. Secondly, the user that will be adding in new people may not actually have the security to do this. Is there a way that I can impersonate another user account that will have permissions and add the account that way?

View 2 Replies

Get User By Distinguished Name Using System.DirectoryServices.Protocols

May 7, 2012

I have a pretty extensive application that has been built to provide SSO to several web applications via OID. The problem is that we have seen some users getting "orphaned" on a role for one of the applications. I have written a method that returns the distinguished name for all of the users with access to that role. To perform the cleanup, I am trying to make sure that the users returned in the previous step actually exist in OID. I have been using the System.DirectoryServices.Protocols.SearchRequest class when searching for users or roles, but it is not working for a distinguished name. Below is my method. It has been changed a couple of times to try different ways to make it work.

[Code]...

View 1 Replies

VS 2008 : Can't Import The System.DirectoryServices Namespace

Dec 17, 2009

I can't import the System.DirectoryServices namespace. It doesn't pop up if that little box thing.Why?

View 2 Replies

Importing System.DirectoryServices Only Reveals The AccountManagment Namespace?

Mar 3, 2011

Where is directoryentry, directorysearcher, searchscope, etc.?

.NET 4.0, VS2010 Professional

View 2 Replies

Asp.net - Setting User's Password Via System.DirectoryServices.Protocols In AD 2008 R2

Jun 29, 2010

I am connecting to a Microsoft Active Directory server in a DMZ from my .net application (asp.net VB .net 4.0). I need to create a new "inetorgperson" in an orgunit called "SingleCustomerAccount".

I have had to use the System.DirectoryServices.Protocols namespace for all the work, because the ADSI classes (System.DirectoryServices namespace) wouldn't work across the DMZ properly.

Anyway it's been working fine connecting to Active Directory on Windows Server 2003 R2; however we're running tests against Active Directory on Windows Server 2008 R2 (2008r2 in native mode for forest and domain) in order to upgrade.

My existing code to create a user does not work.

System.DirectoryServices.Protocols.DirectoryOperationException: The server cannot handle directory requests.
at System.DirectoryServices.Protocols.LdapConnection.ConstructResponse(Int32

[Code].....

View 2 Replies

C# - Check If A User Is Already Logged Into Domain With System.DirectoryServices.AccountManagemen?

Nov 9, 2010

I have computers joined to a domain. I'm writing a desktop application that ask for a username and password to authenticate user against Active Directory.Sometimes, user uses this application on the computer that is not joined to the domain.I'm using .NET 3.5, System.DirectoryServices, and System.DirectoryServices.AccountManagement. Code sample how to authenticate users:

Private Function ValidateExternalUser(ByVal username As String, ByVal password As String) As Boolean
Using context As PrincipalContext = New PrincipalContext(ContextType.Domain, "your_domain_here")
Return context.ValidateCredentials(username, password, ContextOptions.Negotiate)

[code]....

I want to know how to check if user is already logged in on domain computer, then I don't have to ask them log into the application again.

Update:If it can't be done with System.DirectoryServices.AccountManagemen, is there any way to do it?

View 3 Replies

System.DirectoryServices Pegs Processor When Multi-threaded - Can I Lower The Burden?

Feb 23, 2009

My application takes the currently logged-in user and uses an a DirectoryServices.DirectorySearcher to pull a few additional detail about them (some properties we have stored in a few custom AD fields, as well as their email address). This works great, though I've always though it was a little slow - my single-threaded code could only make about 2-3 requests/second to AD.

The real problem came when I moved this code to a web server. With multiple simultaneous users, the number of requests/second jumps greatly, and the LSASS.EXE process pegs on my server. I've checked the domain controllers, and they're just fine - the bottleneck is clearly on the application side. I suspect that what's slowing my down is the NTLM/Kerberos challenge/response, and the number of simultaneous requests pegs even the multi-core processor.

Our network policy doesn't allow anonymous reads from AD, so that choice is out. Also, I've tried every member of "AuthenticationTypes" (in the example, I'm using .FastBind), but they all seem to have about the same throughput rate with the same load on the processor.how I might work around this restriction and lower my demands on the processor? Here is the code I'm using - pretty straightforward:

Dim sPath As String = "LDAP://" & stringUserDN
Dim entry As New DirectoryEntry(sPath)
entry.AuthenticationType = AuthenticationTypes.FastBind[code]......

View 1 Replies

System.DirectoryServices.AccountManagement - Error Adding User To Local Administrators Group But Not Other Groups?

Apr 30, 2012

I am using System.DirectoryServices.AccountManagement to try to add a local account to the local administrators group with the following code but am getting the error below on the group.Members.Add(usr) line. Both usr and group are created as objects and if I create a Test group, I can add the user to the Test group. I know the group object is the local administrators group and not the domain group because i changed the description on the local administratrors group and the group object is correct so it appears to be something specific to the local administrators group.

View 6 Replies

Unable To Access "System.DirectoryServices" From Any Namespace But Presentation Layer

Dec 1, 2009

I am accessing active directory with the System.DirectoryServices library, currently in my web layer. However, I'm trying to move a function from a code-behind file to a VB class in another namespace, and I cannot seem to access that class from within that namespace.

View 1 Replies

VS 2005 - Pier To Pier Network - System.DirectoryServices

Apr 24, 2009

We are setting up authentication for our users in our software and were looking at the System.DirectoryServices that other posts have suggested.

Some of our clients use pier to piers (workgroup) networks since they are only 2-3 computers. Will this still work without a true server or domain? One of the workstations will be the file server but only using something like WXP. Will this still work?

View 5 Replies

Retrieving System Info Via WMI Slow?

Jun 12, 2010

I'm using the below to update a form with system information of a remote machine - it's rather slow at populating the labels, if there a faster method than looping?:

objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "
ootcimv2")

[Code].....

View 1 Replies

.net - Retrieving Data After Using System.Net.Sockets SendFile?

Jun 8, 2012

I'm coding a simple TCP client/server in VB.NET to transfer files of all sizes. I decided to use System.Net.Sockets's command SendFile to transfer the bytes through the socket.

On the receiving side, my code to retrieve the bytes works fairly well, but occasionally the transfer randomly stops. I figured out that by putting a small sleep delay between retrieving the next block of data makes the transfers 100% stable.My code to retrieve the data (until there is no data available) is simplified as this:

While newSocket.Available > 0
Threading.Thread.Sleep(100)
newSocket.ReceiveFrom(data, Remote)
End While

I really hate using that sleep delay and figure there must be a proper method/function to retrieve data from SendFile?

View 1 Replies

Retrieving File Info When The System.IO.FileInfo Struct Doesn't Work

Oct 31, 2008

I have built a recursive file system crawler that amasses file system data from a file share. I use the FileInfo object to get my metrics, however, I am finding that in especially deep file structs, that the ol' 260 character MAX_PATH MS bug crops up ':8-0:'. This puts me in my angry place, since I do not seem to be able to get around it no matter what kind of programmatic tom-foolery I try.

So far, I have tried:- converting to 8.3 format --> no good path + filename STILL is > 260 (believe it or not) - tried to go with a Straight low-level API approach

What I have found is some pretty Sketchy information regarding VB implementation of the kernel32 api's in this regard (just try & find a createfile port for vb.net, I couldnt)

Anyway, I guess I was hoping that someone else has run into this pain, and knows how to make a surefire way to get a file's information (size, dates esp), regardless of how long and painful the path may in fact be...

View 4 Replies

Popup Like To In Mailbox?

May 4, 2009

In my mailbox, google search, etc when we enter 2-3 chars all words starting with those chars come in like a pop up window, we select from that list and the text is displayed in the text box. Same happens in th To/CC/Bcc text fields, we get name and email of our mailbox. I want to implement the same in a form of my MDI application. I want is 2 values same like name, email and on selecting any from the list, it should be displayed in respective text fields. But I haveno clue how to implement this in VB.NET.

how to implement it. I will require the same in more than 1 forms, so is it possible to use Write Once and Use Many times. Atleast 2-3 times is the same data but in differnet forms.

View 4 Replies

Get A List Of Folder From MailBox?

Jun 22, 2010

I have looked high and low and can't seem to find some sample code anywhere.I am looking for a snippet of code that will return all the folders in a Mailbox, not so much the drafts,nbox, outbox, sent items but a custom folder created by the user.Using MS Outlook 2007 ver.12.I know how the look for items in a folder but it only shows me the items in my Inbox.I need to show all the folders available and let the user select the folder to search in Or at this point I would settle for a way to set the defaultfolder. I can make this accept anything other than olFolderInbox?

View 1 Replies

DirectoryServices Authentication?

Sep 18, 2010

The following code works when I run the project exe with admin credntials. How could I pass the credentials in the code?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim HN As String = Me.TB_HN.Text

[code].....

View 2 Replies

Creating An Exchange 2007 Mailbox

Dec 21, 2010

Apologies if this is in the wrong sub-forum. My organization has a custom application for creating and managing AD users and exchange mailboxes. Under exchange 2003 this worked perfectly. Earlier this year we implemented exchange 2007. Some alterations were made to the code to keep it running - and successfully creating mailboxes. This worked up until we removed the last exchange 2003 server.

[Code]....

View 6 Replies

Mailbox Unavailable - User Not Authenticated

Feb 26, 2009

When I run this code it give this error
""Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated"".

The code:
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient
SmtpServer.Credentials = New Net.NetworkCredential(TextBox1.Text, TextBox5.Text)
ProgressBar1.Value = 10
SmtpServer.Port = 587
[Code] .....

View 8 Replies

MySQL Command (create A Mailbox)?

Aug 24, 2009

how to create a mailbox but it seems like im stock cause i dont know the correct syntax. Thats the table inside my database that handles the messages function. Im Logged in as NIXZ. What will this command return i mean it contains multiple variables:

[Code]...

View 9 Replies

Rename User Account And Mailbox?

Feb 22, 2010

I'm trying to rename a user programically and can't figure out the mailboxiece(proxyAddresses).

Working code below...
Public Shared Function renameUser(ByVal curUsername As String, ByVal newUsername As String) As Boolean

[code].....

View 5 Replies

Sql Server - Import Email From AD Mailbox?

Apr 2, 2012

We have an old legacy SQL 2000 server (the last in the farm) - We've been unable to get rid of this server as it uses xp_findnextmsg, xp_readmail etc to monitor a mailbox (via mapi) and import all email to that address into a database. The database contains simple tables that store "from", "to", "subject", "body", "Sent Date" & so on.As you may know, the procs above are no longer in use in SQL 2005+This table is read from dozens of internal systems, for instance emails to this mailbox can be automatically picked up by our helpdesk systems & create calls etc.My question is this: what it the easiest / modern way of doing this in SQL 2008+? Is it going to be a case of writing a .net binary / service that will use smtp or something to connect to a mailbox and insert the data into SQL or is there a simpler way to do it? (SSIS / 3rd party tools / pre-existing code / projects?)

Just thought I'd ask before i start writing something - no point re-inventing the wheel as it were.

PS: The Mailbox in question is an exchange 2010 mailbox.Edit: This functionality was hinted to be re-introduced in 2008 & dbmail: http://connect.microsoft.com/SQLServer/feedback/details/126167/xp-readmail-replacement-for-sql-2005 but it looks like it failed to materialise!

Edit 2: I've just found a decent code sample here that utilises the new web services in exchange 2007+: http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/dd2b465b-b1d2-4c0d-82ec-c36c6c482d5d - experimenting in progress (has anyone ever worked with SQL and the Exchange web services?)

Edit 3: All done! I knocked up a .net service that sits on our exchange server and monitors a mailbox & pushes any new mail into SQL. Incase others have a similar question and need some sample code to get started - here is some rough code (chopped out of my service - replaced parameterised SQL with basic dynamic SQL for easy reading): (Note: you'll need the EWS API 1.1 dll)

[Code]...

View 1 Replies

DirectoryServices To Change An AD Property?

Sep 15, 2011

Want to change a property of a user in Active Directory programatically. I know I need to use DirectoryServices but I keep getting referral errors.

1. I want to connect to the directory an get the property first.

2. I will then use a evaluative expression to find out if step 3 is necessary 3. Want to change ths property

However, I want to run this from client machines so they won't have permission to modify the schema so I created a new users, is it possible to authenticate with one user and change another's?

Tutorials don't seem to show specification of the user the are changing the context user.

View 1 Replies

Adding Mailbox With VB - Upgrade To Exchange 2010?

Jan 21, 2011

We are getting ready to convert to Exchange 2010. Currently we're using VB code to add new users to AD and create mailbox for them with specific settings. I've been trying to figure out - what do I need to change in my code in order for the code to work in Exchange 2010 environment. I've seen some references about using Powershell in a remote environment and guessing that AddPSSnapIn will no longer work. Not sure about hardcoding username and password for remote access. Is there any way to avoid it? Whose u/p should it be anyway? AD user who runs the code? Below I'm posting the code that we using in Exchange 2007. Please let me know what I need to change?

[Code]...

View 8 Replies

C# - Detect New Mails In An Exchange Server Mailbox?

Aug 8, 2011

I have a mailbox that gets alerts from different servers from time to time. Each time, we get this alert, I want it to perform a custom action based on the contents of the email.And I would like to keep it as a service in (C# or VB.net) which can be run from anywhere. Is there an API for reading this?

View 3 Replies

FormLoad Email Mailbox List (Drop Box)?

Jan 7, 2010

One of my clients is going from Server 2000, SQL 2000 w/ VB6 to a new environment of Windows SBS 2008, SQL 2005 standard 64bit, w/ Visual Studios 2005. We have a custom built app written all in VB that has been converted. We already took care restoring the databases and setting up the odbc and such. After conversion, the app threw a couple of errors, and warnings, which have been fixed. We have a formload function that is supposed to populate 2 fields with dropdown information. One is a folders list in outlook and the other is a send recipient. The Recipient field populates fine and the outlook email box does not.Here is the formload code. I can't figure out why this would allow one box to fill and not the other.

Private Sub frmProcessEmail_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
'starts up email
start()

[code]....

View 4 Replies

Get Just A Count Of How Many Items Are Inside A Mailbox Inbox?

Aug 17, 2010

Would I be possible to get just a count of how many items are inside a mailbox inbox??

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved