Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning SecurityGroupDefinition fails #790

Closed
leolorenzoluis opened this issue Feb 22, 2016 · 6 comments
Closed

Provisioning SecurityGroupDefinition fails #790

leolorenzoluis opened this issue Feb 22, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@leolorenzoluis
Copy link

I'm trying to provision security groups in SharePoint 2010 but it failed with an exception

Check ModelNode prop

Using the following code found [here](http://docs.subpointsolutions.com/spmeta2/definitions/sharepoint-foundation/SecurityGroupDefinition/#Adding security group)

public void CanDeploySimpleSecurityGroup()
{
    var auditors = new SecurityGroupDefinition
    {
        Name = "External Auditors",
        Description = "External auditors group."
    };

    var reviewers = new SecurityGroupDefinition
    {
        Name = "External Reviewers",
        Description = "External reviewers group."
    };

    var model = SPMeta2Model.NewSiteModel(site =>
    {
        site
            .AddSecurityGroup(auditors)
            .AddSecurityGroup(reviewers);
    });

    DeployModel(model);
}

I'm using the latest version of M2.

@SubPointSupport
Copy link
Contributor

The model looks good, should be fine.

Would you please provide .InnerException message? M2 exception has .InnerException that contains original SharePoint exception. That would help to address the issue.

@leolorenzoluis
Copy link
Author

Here's the complete stack trace

at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object modelHost, ModelNode modelNode) at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.<>c__DisplayClass6.<Traverse>b__4(Object childModelHost) at SPMeta2.ModelHandlers.ModelHandlerBase.WithResolvingModelHost(ModelHostResolveContext context) at SPMeta2.SSOM.ModelHandlers.SiteModelHandler.WithResolvingModelHost(ModelHostResolveContext context) at SPMeta2.Services.Impl.DefaultModelTreeTraverseService.Traverse(Object modelHost, ModelNode modelNode) at SPMeta2.Services.ModelServiceBase.ProcessModelDeployment(Object modelHost, ModelNode modelNode) at SPMeta2.Services.ModelServiceBase.DeployModel(ModelHostBase modelHost, ModelNode model) at SPMeta2.SSOM.Services.SSOMProvisionService.DeployModel(ModelHostBase modelHost, ModelNode model) at SPMeta2.SSOM.Services.SSOMProvisionServiceExtensions.DeployWebModel(SSOMProvisionService modelHost, SPWeb web, ModelNode model)

@SubPointSupport
Copy link
Contributor

Alright, leave it with us, will see what's wrong there.

We run regression testing on SP2013 only.
SP2010 is only compiled with NET35 and SP2010 assemblies, haven't seen great utilization so never focused on regression there. ETA would be a week or so, will update the ticket accordingly.

@SubPointSupport SubPointSupport added this to the 2016.02.29 milestone Feb 22, 2016
@leolorenzoluis
Copy link
Author

Thank you. By the way, I also tried adding Owner, DefaultUser too. I assume those were the required fields in order to provision a SecurityGroup in SPOM.

@SubPointSupport
Copy link
Contributor

No, only props with ExpectRequired attr are required.
In case security group, Name prop is the only required prop.

@SubPointSupport
Copy link
Contributor

Checked on SharePoint 2010, all good.

Security groups deployment is only supported at the site level. Here is the full snippet:

public void CanDeploySimpleSecurityGroup()
{
    var auditors = new SecurityGroupDefinition
    {
        Name = "External Auditors",
        Description = "External auditors group."
    };

    var reviewers = new SecurityGroupDefinition
    {
        Name = "External Reviewers",
        Description = "External reviewers group."
    };

    var model = SPMeta2Model.NewSiteModel(site =>
    {
        site
            .AddSecurityGroup(auditors)
            .AddSecurityGroup(reviewers);
    });

    DeployModel(model);
}

private void DeployModel(ModelNode model)
        {
            var service = new SSOMProvisionService();

            using (var spSite = new SPSite("http://m2-sp10-01"))
            {
                using (var spWeb = spSite.OpenWeb())
                {
                    service.DeploySiteModel(spSite, model);
                }
            }
        }

With service.DeployWebModel(spWeb , model); call a new SPMeta2UnsupportedModelHostException exception is raised which is default expected behavior.

SPMeta2.Exceptions.SPMeta2ModelDeploymentException: There was an error while provisioning definition. Check ModelNode prop. ---> SPMeta2.Exceptions.SPMeta2UnsupportedModelHostException: modelHost
Result StackTrace:  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants