Add Object Error

Mar 10, 2015 at 4:32 PM
{"The type or property must have the Attribute: 'System.DirectoryServices.Linq.Attributes.DirectoryTypeAttribute'."}

Here is my code:
 var group = new Group();
 group.Name = "TestGroup";
 context.AddObject(group);
 context.SubmitChanges();

 [DirectoryType("group")]
public class Group : EntryObject
    {
        [DirectoryProperty("samaccountname")]
        public string Name { get; set; }

        [EntryCollectionProperty("memberOf", MatchingRule = MatchingRuleType.InChain)]
        public EntryCollection<User> Users
        {
            get
            {
                return ((IEntryWithRelationships)this).RelationshipManager.GetEntryCollection<User>("Users");
            }
        }
    }
I am not sure how to fix this
Coordinator
Mar 10, 2015 at 8:47 PM
Hi @aday,

Can you post the full stacktrace?

Thanks,
Stephen
Mar 11, 2015 at 9:17 PM
at System.DirectoryServices.Linq.TypeExtensions.AssertGetAttribute[TAttribute](ICustomAttributeProvider info) in c:\Projects\Codeplex\adlinq\System.DirectoryServices.Linq\Extensions\TypeExtensions.cs:line 25
at System.DirectoryServices.Linq.DirectoryContext.AddObject[T](String cnName, T entry) in c:\Projects\Codeplex\adlinq\System.DirectoryServices.Linq\DirectoryContext.cs:line 195
at System.DirectoryServices.Linq.DirectoryContext.AddObject[T](T entry) in c:\Projects\Codeplex\adlinq\System.DirectoryServices.Linq\DirectoryContext.cs:line 181
at LinkToADTest.ADTest.CreateGroup() in d:\Development\Components\LinqToADTest\ADTest.cs:line 61
at LinkToADTester.Program.Main(String[] args) in d:\Development\Components\LinqToADTest\LinkToADTester\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()