The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)
hi all,
i trying sample code given at
namespace adam_examples
{
class extendschemacontact
{
/// <summary>
/// extend ad lds schema contact class
/// , additional-information attribute.
/// </summary>
[stathread]
static void main()
{
// writeable attribute.
const int ds_instancetype_nc_is_writeable = 4;
directoryentry objroot; // root of ad lds instance.
directoryentry objschema; // schema partiton.
string strschemanamingcontext; // schema dn.
// schema path.
try
{
objroot = new directoryentry(
"ldap://localhost:389/rootdse");
strschemanamingcontext = objroot.properties[
"schemanamingcontext"].value.tostring();
objschema = new directoryentry(string.concat(
"ldap://localhost:389/", strschemanamingcontext));
console.writeline("schema path: {0}", objschema.path);
console.writeline();
}
catch (exception e)
{
console.writeline("error: schema bind failed.");
console.writeline(" {0}", e.message);
return;
}
// declarations new attribute.
// attribute name.
const string strattributename = "additional-information123";
// new attribute.
directoryentry objnewattribute;
// attribute cn.
string strcnattributename;
// create new attribute.
try
{
strcnattributename = string.concat("cn=",
strattributename);
objnewattribute = objschema.children.add(
strcnattributename, "attributeschema");
}
catch (exception e)
{
console.writeline("error: attribute create failed.");
console.writeline(" {0}", e.message);
return;
}
// set selected values attribute.
try
{
objnewattribute.properties[
"instancetype"].add(ds_instancetype_nc_is_writeable);
objnewattribute.properties[
"attributeid"].add("1.2.840.113556.1.4.265");
objnewattribute.properties[
"attributesyntax"].add("2.5.5.12");
objnewattribute.properties[
"issinglevalued"].add(true);
objnewattribute.properties["rangeupper"].add(32768);
objnewattribute.properties[
"showinadvancedviewonly"].add(true);
objnewattribute.properties[
"admindisplayname"].add(strattributename);
objnewattribute.properties[
"admindescription"].add(strattributename);
objnewattribute.properties["omsyntax"].add(64);
objnewattribute.properties["searchflags"].add(0);
objnewattribute.properties[
"ldapdisplayname"].add("notes");
objnewattribute.properties["name"].add(strattributename);
objnewattribute.properties["systemonly"].add(false);
objnewattribute.properties["systemflags"].add(16);
objnewattribute.properties["objectcategory"].add(
string.concat("cn=attribute-schema,",
strschemanamingcontext));
objnewattribute.commitchanges(); -> exception comes up
console.writeline(
"success: created attributeschema class object:");
console.writeline(" {0}", objnewattribute.name);
}
catch (exception e)
{
console.writeline(
"error: setting attribute properties failed.");
console.writeline(" {0}", e.message);
return;
}
}
to add classes/schema ad using ldap.
i using windows server 2008 std. os.
while executing code of .net. i getting exception as
the server unwilling process request. (exception hresult: 0x80072035)
can me!
thanks.
sorry, i’m not c# expert. suggest invoke ldifde import schema file in program. if have code manually in c#, it’s suggested submit new post in msdn forum more suggestions. best resource kind of problem.
msdn forum
http://forums.microsoft.com/msdn/default.aspx?siteid=1
thanks.
this posting provided "as is" no warranties, , confers no rights.
Windows Server > File Services and Storage
Comments
Post a Comment