locked
how to add a reference to another entity member when creating a member RRS feed

  • Question

  • I need to create a member that one of its Attributes (maybe my term is wrong) is a reference to another entity member named group 

    the code 

    createRequest.Members.MemberType = MemberType.Leaf;
                createRequest.Members.Members = new System.Collections.ObjectModel.Collection<Member> { };
                Member aNewMember = new Member();
                aNewMember.MemberId = new MemberIdentifier() { Name = uag.groupName, MemberType = MemberType.Leaf };
    
    
    
                aNewMember.Attributes = new Collection<MDSService.Attribute>();
    
                aNewMember.Attributes.Add(new MDSService.Attribute { Identifier = groupID }); // groupID is Identifier I got of the referenced group 
    
    //Some other attributes here
    
    createRequest.Members.Members.Add(aNewMember);
    
                // Create a new entity member
                EntityMembersCreateResponse createResponse = clientProxy.EntityMembersCreate(createRequest);
    
    Tells me:  "The attribute data type is not valid"

    Is it wrong to add the reference as attribute? 

    How can I embed the reference in the new member? 


    Ofer Gal

    Thursday, October 23, 2014 8:49 PM

Answers

  • I figured it out!

    You are right the attribute should be of type AttributeValueType.Domain but more important, the value sent should be of type  "Identifier"

    Thanks


    Ofer Gal

    Friday, October 24, 2014 2:32 PM
  • Ofer, 

    I think you are talking about a Domain Attribute: 

    Domain-Based Attributes

    and I think this is the Enumeration that you are looking for. 

    AttributeValueType Enumeration

    Hope this Helps.

    Reeves


    Denver, CO

    • Marked as answer by Ofer Gal Friday, October 24, 2014 2:32 PM
    Friday, October 24, 2014 6:01 AM

All replies

  • Ofer, 

    I think you are talking about a Domain Attribute: 

    Domain-Based Attributes

    and I think this is the Enumeration that you are looking for. 

    AttributeValueType Enumeration

    Hope this Helps.

    Reeves


    Denver, CO

    • Marked as answer by Ofer Gal Friday, October 24, 2014 2:32 PM
    Friday, October 24, 2014 6:01 AM
  • I figured it out!

    You are right the attribute should be of type AttributeValueType.Domain but more important, the value sent should be of type  "Identifier"

    Thanks


    Ofer Gal

    Friday, October 24, 2014 2:32 PM
  • You need to set the type as attribute.Type = <ServiceReference>.AttributeValueType.<Type>. <Type> is emumeration as mentioned by Reeves

    Abhi

    Wednesday, June 17, 2015 1:16 PM