Errors while using AddNewUserToSite

Jun 14, 2007 at 5:14 PM
Hello,

I create a sharepoint site and also created an OU and associated the site with the OU by adding the connection string to the web.confiig file as follows.
<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://coop.test/OU=Hosting, DC=coop,DC=test" />
</connectionStrings>

But when i tryto use AddNewUserToSite method to add a new user i receive "Site Property: OU does not exists" error. I am not sure what the problem since the OU for this site is "Hosting" as mentioned in the web.config. Any help will be very much appreciated.

Here is the line which calls the AddNewUserToSite method in mycode (i have changed the email address for privacy reasons)
service.AddNewUserToSite"http://testbed02/", "first", "last", "login", "Mypswd42", "someemail@site.com", "ADConnectionString");

The error occurs in "ActiveDirectoryWS.cs: under
private DirectoryEntry CreateUserObject(string firstName, string lastName, string userName, string password, string email, string ouName, string ldapConnectionString)
Any help will be appreciated.

Thanks
Regards
Ramprasad
Coordinator
Jun 15, 2007 at 4:43 AM
Hi Ramprasad,

The last parameter of AddNewUserToSite() is the providername, not the Connection string. Could that be the problem?

Lisa


ramprasad1980 wrote:
Hello,

I create a sharepoint site and also created an OU and associated the site with the OU by adding the connection string to the web.confiig file as follows.
<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://coop.test/OU=Hosting, DC=coop,DC=test" />
</connectionStrings>

But when i tryto use AddNewUserToSite method to add a new user i receive "Site Property: OU does not exists" error. I am not sure what the problem since the OU for this site is "Hosting" as mentioned in the web.config. Any help will be very much appreciated.

Here is the line which calls the AddNewUserToSite method in mycode (i have changed the email address for privacy reasons)
service.AddNewUserToSite"http://testbed02/", "first", "last", "login", "Mypswd42", "someemail@site.com", "ADConnectionString");

The error occurs in "ActiveDirectoryWS.cs: under
private DirectoryEntry CreateUserObject(string firstName, string lastName, string userName, string password, string email, string ouName, string ldapConnectionString)
Any help will be appreciated.

Thanks
Regards
Ramprasad


Jun 15, 2007 at 5:35 PM
Lisa,

Thanks for your prompt response. There is another issue that i am facing

Receiving Logon failure: bad username or password error when trying to create the OU using AddNewSiteNewUser() method

The system appears to be using the logged on user credentials to create the new OU in Active Directory but in the provider form of MyAdMembershipProvider:username instead of the DOMAIN\username format that the AD would recognize and authorize for the procedure of creating the OU.



How can we either change Sharepoint to use the DOMAIN\username format or make Active Directory recognize and authorize the MyAdMembershipProvider:username format?

Thanks
Regards
Ramprasad




lisataka wrote:
Hi Ramprasad,

The last parameter of AddNewUserToSite() is the providername, not the Connection string. Could that be the problem?

Lisa


ramprasad1980 wrote:
Hello,

I create a sharepoint site and also created an OU and associated the site with the OU by adding the connection string to the web.confiig file as follows.
<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://coop.test/OU=Hosting, DC=coop,DC=test" />
</connectionStrings>

But when i tryto use AddNewUserToSite method to add a new user i receive "Site Property: OU does not exists" error. I am not sure what the problem since the OU for this site is "Hosting" as mentioned in the web.config. Any help will be very much appreciated.

Here is the line which calls the AddNewUserToSite method in mycode (i have changed the email address for privacy reasons)
service.AddNewUserToSite"http://testbed02/", "first", "last", "login", "Mypswd42", "someemail@site.com", "ADConnectionString");

The error occurs in "ActiveDirectoryWS.cs: under
private DirectoryEntry CreateUserObject(string firstName, string lastName, string userName, string password, string email, string ouName, string ldapConnectionString)
Any help will be appreciated.

Thanks
Regards
Ramprasad



Coordinator
Jun 17, 2007 at 11:21 PM
Hi Ramprasad,
Setting the attributeMapUsername attribute to sAMAccountName in the <membership> section will allow you to specify domain\user.
In the source download, you'll find a Hosting Web Services Readme.doc in User and Site Provisioning Web Services folder. The document refers to setting up Forms Auth for the ActiveDirectoryMembershipProvider. You will find information regarding the connectionUsername.

Regards,
Lisa


ramprasad1980 wrote:
Lisa,

Thanks for your prompt response. There is another issue that i am facing

Receiving Logon failure: bad username or password error when trying to create the OU using AddNewSiteNewUser() method

The system appears to be using the logged on user credentials to create the new OU in Active Directory but in the provider form of MyAdMembershipProvider:username instead of the DOMAIN\username format that the AD would recognize and authorize for the procedure of creating the OU.



How can we either change Sharepoint to use the DOMAIN\username format or make Active Directory recognize and authorize the MyAdMembershipProvider:username format?

Thanks
Regards
Ramprasad




lisataka wrote:
Hi Ramprasad,

The last parameter of AddNewUserToSite() is the providername, not the Connection string. Could that be the problem?

Lisa


ramprasad1980 wrote:
Hello,

I create a sharepoint site and also created an OU and associated the site with the OU by adding the connection string to the web.confiig file as follows.
<connectionStrings>
<add name="ADConnectionString" connectionString="LDAP://coop.test/OU=Hosting, DC=coop,DC=test" />
</connectionStrings>

But when i tryto use AddNewUserToSite method to add a new user i receive "Site Property: OU does not exists" error. I am not sure what the problem since the OU for this site is "Hosting" as mentioned in the web.config. Any help will be very much appreciated.

Here is the line which calls the AddNewUserToSite method in mycode (i have changed the email address for privacy reasons)
service.AddNewUserToSite"http://testbed02/", "first", "last", "login", "Mypswd42", "someemail@site.com", "ADConnectionString");

The error occurs in "ActiveDirectoryWS.cs: under
private DirectoryEntry CreateUserObject(string firstName, string lastName, string userName, string password, string email, string ouName, string ldapConnectionString)
Any help will be appreciated.

Thanks
Regards
Ramprasad




Jun 19, 2007 at 2:33 PM
Lisa,

I already have this setting in my web.config file. I tried to call the web service from a windows application (Client) using the following code block.

try
{
testbed02.MyService service = new WindowsApplication1.testbed02.MyService();
service.UseDefaultCredentials = true;
service.AddNewUserToSite("http://testbed02/", "abc", "def", "Testa", "Mycoop42", "abc@mail.com", "Providername");
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}

I am reciving a "Request Failed with HTTP Status 403: Forbidden" error which looks like a permissions issue. Am i doing anything wrong here? Do i need to specify the logon credentials some other way in place of setting the UseDefaultCredentials to true? I have also tried using network credentials instead which gives me the same error (this used to work in SP 2003 where i was using windows integraed authentication). Any ideas will be much appreciated.

Thanks,
Regards,
Ramprasad