set Extended Attributes while creating a Group

Hi 

I am  trying to create a group using the below code 

public static Group CreateGroup(string name,string Description,string grouptype,int parentGroupId,string expdate)
		{
			IList<ExtendedAttribute> list = new List<ExtendedAttribute>();
			ExtendedAttribute extendedAttribute = new ExtendedAttribute
			{
				Key = "GroupSubscExpDate",
				Value = "test"
			};
			list.Add(extendedAttribute);
			Group group = null;
			GroupsCreateOptions gcp = new GroupsCreateOptions
			{
				ParentGroupId = parentGroupId,
				Description = Description,
				AutoCreateApplications = false,
				ExtendedAttributes = list
			};


			Apis.Get<IUsers>().RunAsUser("admin", () =>
			{
				group=Apis.Get<IGroups>().Create(name, grouptype, gcp);
			});
			return group;
		}

Group created successfully .But i cant able to find any Extended Attributes while accessing the group using widget api $core_v2_group.Get()  , what wrong with the code ?

Also when i try to create a group from widget api how can i pass extended attributes , I tried with the below code ,but its throwing error 

#set($extendedattr = "%{'_ExtendedAttributes_MyKey'= 'MyValue'}")

$core_v2_group.Create("Test", "PrivateListed", "%{ AutoCreateApplications = false, ExtendedAttributes = $extendedattr}")

  • Former Member
    +1 Former Member

    Here is the format for adding extended attributes through velocity.  The second line will show the extendedattributes that are returned on the group object.

    #set ($group = $core_v2_group.Create("Test11", "PrivateListed", "%{ _ExtendedAttributes_Test = 'Value', _ExtendedAttributes_Test2 = 'Value2' }"))
    $core_v2_utility.Describe($group.ExtendedAttributes)