Add random number to a email id while creating account in active directory

Hi,
I have this code with me,
in this code i am creating user account into the active directory, i am facing issue in validating it.
validation is: Let's say we got 2nd Aman verma into the active directory, first aman verma got id as [email protected], i want id of second aman verma as [email protected] (or any other number at the place of 1)
below is my code,
using System;
using System.IO;
using System.DirectoryServices;
namespace ActiveDirectoryAddContacts
class Class1
static void Main(string[] args)
System.DirectoryServices.DirectorySearcher DSESearcher = new System.DirectoryServices.DirectorySearcher();
string RootDSE=DSESearcher.SearchRoot.Path;
RootDSE=RootDSE.Insert(7,"ou=Mytest,");
DirectoryEntry myDE = new DirectoryEntry(RootDSE);
DirectoryEntries myEntries = myDE.Children;
// Create a new entry 'Sample' in the container.
FileStream fs = new FileStream("C:\\UserDetails.csv" , FileMode.OpenOrCreate, FileAccess.Read
StreamReader sr = new StreamReader(fs); 
for(int i=1;i<291;i++)
string str = sr.ReadLine();
char[] ca={','};
try
string[] sa = str.Split(ca,4);
DirectoryEntry myDirectoryEntry = myEntries.Add("CN="+sa[2], "user");
myDirectoryEntry.Properties["givenname"].Value=sa[0];
//myDirectoryEntry.Properties["sn"].Value=sa[1];
//myDirectoryEntry.Properties["displayname"].Value=sa[2];
//myDirectoryEntry.Properties["mail"].Value=sa[3];
//myDirectoryEntry.CommitChanges();
catch (Exception e)
Console.WriteLine(str);
any Help will be highly appreciated.
Thank you!
Aman 

Hi,
As this might not be a SharePoint issue, I suggest you open a thread in the Windows Server forum, you will get more help and confirmed answers there:
https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverDS
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]

Similar Messages

  • HT5622 I'm currently sharing my apple ID with my wife.  we'd like to create a new ID but are unable to associate her existng email address with a new apple ID.  Is there a way she can maintain her existing email address while creating a new apple ID?

    I'm currently sharing my apple ID with my wife.  We'd like to create a new ID but are unable to associate her existing email address to a new apple ID.  Is there a way she can maintain her existing email address while creating a new apple ID?

    Leave her ID alone and create a new one for yourself with your email address.

  • Add a custom table for field selection while creating field catalog for LIS

    Hi,
    I have a requirement to add a Custom table to be available for field selection while creating a field catalog for LIS. Its required as there are many custom fields to be used for field catalog creation and adding them in one of the existing tables listed is not a feasible option for us. Please let me knw if its possible..?? If yes how to get it done..??
    Regards,
    Akash Sinha

    hi,
    You need to add your field in the Data Dictionary first. For example, if
    you want the new field in the Order Item field catalog do the following.
    Look at structure MCVBAPUSR (SE11). If you already have a user structure
    appended to this structure then you can add your new field to your existing
    structure. If there is no structure already appended to MCVBAPUSR then you
    must create a new structure with your field in it and then append the new
    structure to this one.
    If you look at structure MCVBAP you will see the data appended to the end
    of it.
    Now you should see it in the field catalog.
    regards,
    balajia

  • Error while creating Account ID

    Dear SAP Friends,
                               While creating an Account ID for a House Bank, I am getting the error saying: <u>Entry in field Bank Acct. No. is longer than 09 characters</u>. My Bank account number is of 12 digits. So where I can change the settings from 09 characters to 12 characters to remove this error.
    Regards,
    Sim

    Hi Sim,
    SAP allows bank account # up to 18 charactors, i don't know why you have the error msg.

  • If I dont verify my email address will my account be activated?

    I accidently made and Apple ID to a email accout that is no longer activated...so I am unable to verify my email address.  Yahoo closed my email account and wont let me reactivate it.  I put my credit card info in when I was setting it up. 

    Hi bhejhay,
    If you have questions about your Apple ID and verification, you may find the following article helpful:
    Apple Support: Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Regards,
    - Brenden

  • Desperate HELP with Random Numbes in an Array & Do / While

    Please somebody help, I have been working this problem for over 7 days now and can't get it. I have tried everything from a while to a do while to this and that. I need to have an Array of 8 that when run will produce random numbers for output between 15 to 25. I CAN"T GET IT PLEASE HELP. I am new to JAVA and have done everything I can think of to resolve this. I even have purchased a new book and looked at every site trying to find a solution. PLEASE HELP! Here it is:
    import javax.swing.*;
    public class RandomArray{
    public static void main (String [ ] args) {
    JTextArea outputArea = new JTextArea ( );
    int myArray [ ]; //array declaration
    myArray = new int [ 8 ]; //allocating memory
    String output = "Array values at initializatioon ";
    output += "\nIndex\tValues";
    for ( int i = 0; i < myArray.length; i ++)
    output += "\n" + i + "\t" + myArray [ i ];
    output += "\n\nArray values after assigning values within the range of 15 and 25";
    do {( int i = 0; i <myArray.length; i++)
         while     myArray [ i ] = 15 + (int) (Math.random ( ) * 25);
    output += "\n" + i + "\t" + myArray [ i ];}
    outputArea.setText (output);
    JOptionPane.showMessageDialog (null, outputArea,
    "Array Value before and after",
    JOptionPane.INFORMATION_MESSAGE);
         System.exit ( 0 );
    The output that I need is in two columns one with the initial array 0-7 and the second should be random numbers 15-25. Please help, please

    here you are :
    import javax.swing.*;
    public class RandomArray
    public static void main (String [ ] args)
         JTextArea outputArea = new JTextArea();
         int       myArray [] = new int[8];
         String output = "Array values at initializatioon ";
         output += "\nIndex\tValues";
         for (int i = 0; i < myArray.length; i ++)
              output += "\n" + i + "\t" + myArray [ i ];
         output += "\n\nArray values after assigning values within the range of 15 and 25";
         for (int i = 0; i < myArray.length; i++)
              myArray [ i ] = 15 + (int) (Math.random ( ) * 10);
              output += "\n" + i + "\t" + myArray [ i ];
         outputArea.setText(output);
         JOptionPane.showMessageDialog (null, outputArea,
              "Array Value before and after",
              JOptionPane.INFORMATION_MESSAGE);
         System.exit(0);

  • RMAN Connections To Primary DB While Creating Standby With Active Database

    OS Version : AIX 6.1
    DB Version : 11.2.0.1
    I am creating a standby database with active database option (without any backups). When i am checking number of connections in my primary database, i can see 3 rman connections
    from the standby machine. How oracle reaches to a conclusion of 3 sessions ? Is this number fix or this number can be manipulated with requirment ?
    SQL> select sid,serial#,program from v$session;
           SID    SERIAL# PROGRAM
             1          1 oracle@cph-core-db01-s (DIA0)
             2          1 oracle@cph-core-db01-s (MMNL)
             3          1 oracle@cph-core-db01-s (QMNC)
            32          1 oracle@cph-core-db01-s (MMAN)
            33          1 oracle@cph-core-db01-s (DMON)
            34          3 oracle@cph-core-db01-s (Q000)
            63          1 oracle@cph-core-db01-s (PMON)
            64          1 oracle@cph-core-db01-s (DBW0)
            65          3 sqlplus@cph-core-db01-s (TNS V1-V3)
            66         10 oracle@cph-core-db01-s (Q001)
            94          1 oracle@cph-core-db01-s (VKTM)
           SID    SERIAL# PROGRAM
            95          1 oracle@cph-core-db01-s (LGWR)
            96          3 oracle@cph-core-db01-s (INSV)
            *97         27 rman@cph-core-db02-s (TNS V1-V3)*
           125          1 oracle@cph-core-db01-s (GEN0)
           126          1 oracle@cph-core-db01-s (CKPT)
           127          3 oracle@cph-core-db01-s (ARC0)
           *129         18 rman@cph-core-db02-s (TNS V1-V3)*
           156          3 oracle@cph-core-db01-s (ARC1)
           157          1 oracle@cph-core-db01-s (DIAG)
           158          1 oracle@cph-core-db01-s (SMON)
           159         12 oracle@cph-core-db01-s (SMCO)
           SID    SERIAL# PROGRAM
           187          1 oracle@cph-core-db01-s (DBRM)
           188          1 oracle@cph-core-db01-s (RECO)
           189          1 oracle@cph-core-db01-s (ARC2)
           192          2 oracle@cph-core-db01-s (W000)
           218          1 oracle@cph-core-db01-s (PSP0)
           219          1 oracle@cph-core-db01-s (MMON)
           221          1 oracle@cph-core-db01-s (ARC3)
           *222          3 rman@cph-core-db02-s (TNS V1-V3)*

    Check for the RMAN parallelism in standby database it might be set to 3.
    RMAN> show all;
    or
    Might be you had allocated 3 channels while executing active standby database query.

  • Foreign Trade data is incomplete error while creating accounting document:

    Dear laxmipathy&other SD Guru s,
    As per your suggestion (you have given an answer for the same question) I have tried to fill up the following fields:
    -Business transaction type for foreign trade
    -Export/import procedure for foreign trade
    -Commodity code /Import code Number for foreign trade
    But the system is not accepting it is showing error message again saying that foreign trade data is incomplete.
    Kindly help.
    Sushil

    Hi,
    You need to maintain this data in customization. Menu path:
    Materials Management->Purchasing->Foreign Trade & Customs->Transportation Data->Define Modes of Transport.
    This data needs to be maintained aagainst country "IN' if the plant is located in India.
    If useful, pl close the posting.
    Muraleedharan.R

  • Error while creating account in Oracle Service Registry

    When I try to create an account or try to synchronise with discovery registry using admin account,I am getting fatal error.To be presise, the error is like this:
    Error number: 32001
    Error code: FatalError
    A fatal error occurred in the approval process. For help please contact the administrator of the registry.
    Can anybody help?

    I have this issue as well. I saw in another post that it's a bug in the ODBC drivers? Which has been addressed or not addressed?
    What's note 403021.1 say? I don't understand why I can't just download the fix/patch/workaround instructions from the same page I downloaded the client?

  • Error While Creating Project From Active Workspace.

    Hi Friends,
    While I am trying to create Project (WebDynpro DC) from my Active Workspace.
    I am getting few errors..They are as follows.
    1> .classpath (read only exception) --- By mistakenly .classpath was added to one of my activity and it is in DTR. So kindly suggest me a solution to Delete this file.
    2> Resource ProjectProperties.wdproperties is not in sync with latest version.
    To delete resource:
    - check-in changes and then delete.
    - revert resource and then delete.
    Kindly suggest me some solutions.
    Thanks and Regards.
    Yajush Mishra

    Hi,
    The neccesary configuration for cProjects & SAP-PS interface are as follows.
    1. Project Types in cProjects, Object types, Organisation unit with Org structure in line with project profile
    2. Activate Accounting integration
    3. Object types for object link (WBSE in this case)
    4. Accounting integration using cost collector
    5. Easy cost planing settings both in R/3 systems & cProjects
    6. Project profile configuration in R/3 (cProjects standard)
    7. CO Scenario maintainance view determination (Multi level controlling-Project role, automatic)
    All the enterprise structure assignments should be same in cProjects & R/3.
    Hope this may help you.
    Regards,
    Rakesh Pradhan

  • Email Stuck - SMTP Relay To Remote Active Directory Site 451 4.4.0 Primary target IP address responded with: ""421 4.4.2 Connection dropped due to SocketError

    hi All, 
    I have 2 HT, located different AD Site. HT1 located in HO Site, and HT2 located in Branch Site.
    User from HO site can send email to branch site, but user from branch site cannot send email to HO site.
    I found this error on Queue Viewer Console:
    451 4.4.0 Primary target IP address responded with: ""421 4.4.2 Connection dropped due to SocketError."" Attempted failover to alternate host, but that did not succeed. Either there are no alternate hosts, or delivery failed
    to all alternate hosts
    disable all receive connector except default connector still no luck. Telnet SMTP to HT1 from HT2 is working fine.
    Event Viewer warning, event ID: 2006.
    Send connector Intra-Organization SMTP Send Connector: the connection to IPHT1:25 was disconnected by the remote server.
    Send SMTP Log:
    2014-03-10T07:11:50.624Z,Intra-Organization SMTP Send Connector,08D109CB5D495BDE,19,IPHT2:57231,IPHT1:25,-,,Remote
    2014-03-10T07:21:50.716Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,0,,IPHT1:25,*,,attempting to connect
    2014-03-10T07:21:50.763Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,1,IPHT2:15741,IPHT1:25,+,,
    2014-03-10T07:21:50.825Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,2,IPHT2:15741,IPHT1:25,<,"220 IPHT1.jakarta.com Microsoft ESMTP MAIL Service ready at Mon, 10 Mar 2014 14:21:50 +0700",
    2014-03-10T07:21:50.825Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,3,IPHT2:15741,IPHT1:25,>,EHLO IPHT2.jakarta.com,
    2014-03-10T07:21:50.872Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,4,IPHT2:15741,IPHT1:25,<,250-IPHT1.jakarta.com Hello [IPHT2],
    2014-03-10T07:21:50.872Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,5,IPHT2:15741,IPHT1:25,<,250-SIZE 104857600,
    2014-03-10T07:21:50.872Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,6,IPHT2:15741,IPHT1:25,<,250-DSN,
    2014-03-10T07:21:50.872Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,7,IPHT2:15741,IPHT1:25,<,250-ENHANCEDSTATUSCODES,
    2014-03-10T07:21:50.872Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,8,IPHT2:15741,IPHT1:25,<,250-STARTTLS,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,9,IPHT2:15741,IPHT1:25,<,250-X-ANONYMOUSTLS,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,10,IPHT2:15741,IPHT1:25,<,250-AUTH NTLM,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,11,IPHT2:15741,IPHT1:25,<,250-X-EXPS GSSAPI NTLM,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,12,IPHT2:15741,IPHT1:25,<,250-8BITMIME,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,13,IPHT2:15741,IPHT1:25,<,250-BINARYMIME,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,14,IPHT2:15741,IPHT1:25,<,250-XEXCH50,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,15,IPHT2:15741,IPHT1:25,<,250-XRDST,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,16,IPHT2:15741,IPHT1:25,<,250 XSHADOW,
    2014-03-10T07:21:51.091Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,17,IPHT2:15741,IPHT1:25,>,X-ANONYMOUSTLS,
    2014-03-10T07:21:51.122Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,18,IPHT2:15741,IPHT1:25,<,220 2.0.0 SMTP server ready,
    2014-03-10T07:26:51.590Z,Intra-Organization SMTP Send Connector,08D109CB5D495C06,19,IPHT2:15741,IPHT1:25,-,,Remote
    2014-03-10T07:26:51.590Z,Intra-Organization SMTP Send Connector,08D109CB5D495C0E,0,,IPHT1:25,*,,attempting to connect
    2014-03-10T07:26:51.636Z,Intra-Organization SMTP Send Connector,08D109CB5D495C0E,1,IPHT2:15794,IPHT1:25,+,,
    anyone have a clue?
    thanks.
    Endrik
    Endrik | blog: itendrik.wordpress.com Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

    Hi Niko, 
    I already disable IPv6 and IPv4 checksum offloading, also check the MTU on each HT but still no luck.
    I found the following error on the Netmon:
    i already tls on receive connector, enable anonymous authentication, still no luck.
    any idea?
    thanks.
    Endrik
    Endrik | blog: itendrik.wordpress.com Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

  • Time machine Error "unable to complete backup. An error occurred while creating the back up directory."

    I had the above error and used Time machine Buddy to get the log:
    "Starting standard backup
    Backing up to: /Volumes/Home Back UP/Backups.backupdb
    Error: (-50) Creating directory 2011-10-08-114232.inProgress
    Failed to make snapshot container.
    Backup failed with error: 2"
    Anyone know what could cause this sort of error?

    File System Errors
    -50   paramErr        Error in user parameter list
    Open Disk Utility after turning off TM, Verify or Repair both Drives, (not Repair Permissions).
    Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, then trash this file & reboot...
    /Library/Preferences/com.apple.TimeMachine.plist
    And this file if it exists...
    /Users/YourUserName/Library/Preferences/ByHost/com.apple.TimeMachine.<12digitHex Number>.plist
    Setup TM again.

  • XLA tables and column names while creating accounting in AP.

    Dear All,
    Could anybody please tell me what are the columns of the XLE tables gets hitted when i am creating accounting for an AP invoice?
    Also Please let me know from which tables and which columns, i can get all eligible invoices for payment?
    any code snippet is highly appreciated.
    Thanks & Regards,
    BS.

    HI BS,
    Simply run a diagnostic on the respective invoice from the front end, and you will get the required information.
    Thanks &
    Best Regards,

  • Error while password sync with Active directory.

    Hi all.
    Am doing active directory password sync with oim 11g but this gives an error
    Debug [07/31/12 11:52:14] CONFIG VALUE LENGTH
    Debug [07/31/12 11:52:14] 254
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] Before adding configsync attributes
    Debug [07/31/12 11:52:14]
    sgslrgac instance
    Debug [07/31/12 11:52:14] User Name --->
    Debug [07/31/12 11:52:14] TEST.TEST10
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] RelativeId:
    Debug [07/31/12 11:52:14] 1122
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14]
    sgsladac Instance
    Debug [07/31/12 11:52:14]
    LDAP Connected
    Debug [07/31/12 11:52:14] search string :
    Debug [07/31/12 11:52:14] (&(objectCategory=person)(objectClass=user)(sAMAccountName=TEST.TEST10))
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] Connected to ADSI
    Debug [07/31/12 11:52:14] After Search
    Debug [07/31/12 11:52:14] SID::
    Debug [07/31/12 11:52:14] S-1-5-21-449192332-2375483478-3823051035-1122
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] DN::
    Debug [07/31/12 11:52:14] CN=test test10,CN=Users,DC=thakralone,DC=com
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] GUID:::
    Debug [07/31/12 11:52:14] QHetRJE7hEKkG8PeqYRKlQ==
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14] after ladp search
    Debug [07/31/12 11:52:14] Success sgsldpap
    Debug [07/31/12 11:52:14]
    Passlen populated :
    Debug [07/31/12 11:52:14] 190
    Debug [07/31/12 11:52:14]
    Debug [07/31/12 11:52:14]
    Moving sgsloidi from asynchSystem
    Debug [07/31/12 11:52:14] Store Object populated
    Debug [07/31/12 11:52:14] [getObjectGuid=QHetRJE7hEKkG8PeqYRKlQ==
    getPasswordLen=190
    getUserDn=CN=test test10,CN=Users,DC=thakralone,DC=com
    getUserId=TEST.TEST10
    Debug [07/31/12 11:52:14]
    ***end of status
    Debug [07/31/12 11:52:14]
    Out of sgsloidi from asynchSystem
    Debug [07/31/12 11:52:14]
    Before Free
    Debug [07/31/12 11:52:14]
    After Free
    i have tried to reconfig and reinstall the connector but still the same issue.

    Don't think so.
    Reconcile will just find accounts that are out of sync (that is, that exist on one system but not the other). It doesn't update account attributes.
    ActiveSync can identify and process changed records, but the password itself is hashed, so unless you can use the hashed password directly (and IDM can't) then you just would get "garbage" data via the sync.
    I think you do need to use one of the PasswordSync tools for this, because they intercept the password change process before the password is hashed, allowing you to apply the changes in multiple locations.

  • Contact problem while creating account Web UI

    Hi everyone,
    I have a problem when I want to create a new account, starting from the detail view of an existing account.
    When I press the new button, the contact, marketing attributes and relationship are copied from the existing account. Those fields should normally be empty.
    However when I press enter or save, they dissapear and are empty again, like they should be from the beginning.
    Does anyone know which SAP Note,code, ... can solve this problem?
    Kr,
    Maarten

    Hi,
    The problem may be due to custom controller of BP not getting cleared when you create new account from existing account. So values are getting transfered from your existing account to new account. I think you need to clear values in custom controller.
    Again, values might be getting diappeared because on save event, default value is provided to those fields.
    Have you done some enhancement on BP?
    Best regards
    Pankaj Kumar

Maybe you are looking for

  • Creative Cloud is Blank, nothing is displayed even after a reboot, what is the solution?

    I did the following but it did not help, Rename the opm.db file. 1.Close the Creative Cloud application if it's running. 2.Navigate to the OOBE folder. Windows: [System drive]:\Users\[username]\AppData\Local\Adobe\OOBE Mac OS: /User/<username>/Librar

  • IPhone 5c OS 8.2 will not boot up and hangs on apple logo

    I have upgraded my 5c to 8.2 and reset all the settings so that I can transfer the user , it now will not boot past the apple logo , can anyone help?

  • How can I uninstall FF4 and go back to FF3.x?

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/814655]'' I have nothing but constant issues with video not running, my Google Analytics page freezing up, Facebook lagging, and other weird and annoying garbage with Fire

  • Netui: anchor tag with target attribute.

    I am using the netui:anchor tag inside an iframe to post to an action. But the resulting page is displayed within the iframe. Will the target attribute of the netui:anchor tag help solve the problem. What is a valid value of the target attribute. tha

  • Error -48 when sync

    I've got a new 160 Gb classic Ipod and I have a backup of all my music in a external hard disk. Every time (automatic or manual )I try to sync the music with itunes, sooner or later appears this message:" unknown error (-48) it is not posible to sync