Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Fri, 28 Oct 2005 16:35:12 -0600,    group: microsoft.public.platformsdk.active.directory        back       


DirectoryEntry binding to metabase   
I am trying to use the C# method shown here:  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/f55859db-6d44-46f3-ab25-751a23629f4a.asp

in order to programatically add domains to an IIS 6 SMTP server. It worked  
in the past (ever heard THAT before?) but stopped working for reasons  
beyond my ken.  I've tried adding user credentials for the adminsitrator  
to the DirectoryEntry creation, fiddled with IIS authentication all to no  
avail.

Immediately on creating the "path" object shown below I can see it isn't  
connecting to the MetaBase. Letting the code run produces an "Unknown  
(0x80005000)" error.

// Machine executing this code is WinXP SP2
// Machine targted by this code is Win2003 SP1

string result="";
string metabasePath =  
"IIS://a.server.local/SmtpSvc/1/Domain/existingdomain.com";													
string newParentPath ="IIS://a.server.local/SmtpSvc/1/Domain/";
string newName = "newdomain.com";
try
{
	DirectoryEntry path = new DirectoryEntry(metabasePath);
	// at this point Path.Bound = false
	DirectoryEntry newParent = new DirectoryEntry(newParentPath);				
	if (path.Parent.SchemaClassName.ToString() ==  
newParent.SchemaClassName.ToString())
	{
		DirectoryEntry newPath = path.CopyTo(newParent, newName);
		newParent.CommitChanges();
		result = "successfull copy from "+newParent.Path+" to "+newName;
	}
	else
		result = "Failed in CopyMetabaseNode; parent mismatch";
	catch (Exception ex)
	{
		result = "Failed in CopyMetabaseNode with the following exception:  
"+ ex.Message;
	

-- 
David L. West
http://www.deskoptional.com
date: Fri, 28 Oct 2005 16:35:12 -0600   author:   David L. West

Re: DirectoryEntry binding to metabase   
I'm not sure what the error here is as I don't really use the IIS provider, 
but you should be aware that you cannot supply credentials when using the 
IIS provider.  You have to be running under the security context of an admin 
on the box you are trying to modify.

Joe K.

"David L. West"  wrote in message 
news:op.szdnoycaz54syx@clea.dna.local...
>I am trying to use the C# method shown here: 
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/f55859db-6d44-46f3-ab25-751a23629f4a.asp
>
> in order to programatically add domains to an IIS 6 SMTP server. It worked 
> in the past (ever heard THAT before?) but stopped working for reasons 
> beyond my ken.  I've tried adding user credentials for the adminsitrator 
> to the DirectoryEntry creation, fiddled with IIS authentication all to no 
> avail.
>
> Immediately on creating the "path" object shown below I can see it isn't 
> connecting to the MetaBase. Letting the code run produces an "Unknown 
> (0x80005000)" error.
>
> // Machine executing this code is WinXP SP2
> // Machine targted by this code is Win2003 SP1
>
> string result="";
> string metabasePath = 
> "IIS://a.server.local/SmtpSvc/1/Domain/existingdomain.com"; string 
> newParentPath ="IIS://a.server.local/SmtpSvc/1/Domain/";
> string newName = "newdomain.com";
> try
> {
> DirectoryEntry path = new DirectoryEntry(metabasePath);
> // at this point Path.Bound = false
> DirectoryEntry newParent = new DirectoryEntry(newParentPath); if 
> (path.Parent.SchemaClassName.ToString() == 
> newParent.SchemaClassName.ToString())
> {
> DirectoryEntry newPath = path.CopyTo(newParent, newName);
> newParent.CommitChanges();
> result = "successfull copy from "+newParent.Path+" to "+newName;
> }
> else
> result = "Failed in CopyMetabaseNode; parent mismatch";
> catch (Exception ex)
> {
> result = "Failed in CopyMetabaseNode with the following exception:  "+ 
> ex.Message;
>
>
> -- 
> David L. West
> http://www.deskoptional.com
date: Mon, 31 Oct 2005 10:03:13 -0600   author:   Joe Kaplan \(MVP - ADSI\)

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us