-1

I am using ldapjs and explore complete library and could not be able to find how to create OU. Kindly share with example and code explanation.

1 Answers1

0

Resolve my query by the following code

async createOU(oRequest) {
    const ouName = oRequest.ouName
    let DN = 'ou=' + ouName + ',' + this.dc;
    let entry = {
        objectclass: ADConstant.AD_PARAMS.OU_GROUP,
    };
    return new Promise(async (resolve, reject) => {
        this.ADConnnection.add(DN, entry, (err, res) => {
            if (err) {
                reject(err);
            } else {
                resolve(true);
            }
        });
        await this.closeConnection()
    });
};

for reference follow the link: https://github.com/ldapjs/node-ldapjs/issues/827