문제

I am creating termset in SharePoint Hosted App with below code. but it is giving error Access denied. You do not have permission to perform this action or access this resource. Whereas logged in user is owner for that group where i am creating this termset.

createTerm: function (termName) {
        var _this = this;
        //Current Context
        var context = SP.ClientContext.get_current();

        //Current Taxonomy Session
        var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);

        //Term Stores
        var termStores = taxSession.get_termStores();

        //Term Store under which to create the term.
        var termStore = termStores.getByName(_this.termStoreName);

        //Term Set under which to create the term.
        var termSet = termStore.getTermSet(_this.termSetId);

        //Create new guid
        var termGuid = new SP.Guid.newGuid()

        //Name of the term, LCID and a new GUID for the term.
        var newTerm = termSet.createTerm(termName, 1033, termGuid.toString());

        newTerm.set_isAvailableForTagging(true);

        context.load(newTerm);

        context.executeQueryAsync(function (sender, args) {
            _this.termMetadataString = termName + ";" + termGuid.toString();
            _this.upsertAuditFormItem("Term Metadata string");
        }, function (sender, args) {
            console.log(args.get_message())
            alert("Here it is throwing error. Which i mentioned earlier");
            AuditUtility.hideLoading();
        });
    },
도움이 되었습니까?

해결책

Looks like your app doesn't have permission to write data to the term store.

To provide permission , go to the Appmanifest.xml file and provide write permission the Taxonomy scope.

enter image description here

Deploy the app again and it should work now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top