Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. GroupPrincipalExt can not be used in a query against this store

GroupPrincipalExt can not be used in a query against this store

Scheduled Pinned Locked Moved C#
databasehelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JD86
    wrote on last edited by
    #1

    I created a class so I can add extensions to the GroupPrincipal object but I am getting this error: System.InvalidOperationException: Principal objects of type CloudPanel.AD.Custom.GroupPrincipalExt can not be used in a query against this store. at System.DirectoryServices.AccountManagement.ADStoreCtx.GetObjectClassPortion(Type principalType) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRefHelper(Type principalType, String urnScheme, String urnValue, DateTime referenceDate, Boolean useSidHistory) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRef(Type principalType, String urnScheme, String urnValue, DateTime referenceDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue) at CloudPanel.AD.Custom.GroupPrincipalExt.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue) at CloudPanel.Exchange.ExchPs.Get_DistributionGroup(String distinguishedname) I don't really know why this isn't working since I have used this class before. Here is a piece of the class I created (I didn't include all the DirectoryProperties since there are a bunch that I've added):

    public class GroupPrincipalExt : GroupPrincipal
    {
    public GroupPrincipalExt(PrincipalContext context) : base(context) { }
    public GroupPrincipalExt(PrincipalContext context, string groupName) : base(context, groupName) { }

        public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, string identityValue)
        {
            return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityValue);
        }
    
        public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue)
        {
            return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityType, identityValue);
        }
    
        \[DirectoryProperty("wWWHomePage")\]
        public string WWWHomePage
        {
            get
            {
                if (ExtensionGet("wWWHomePage").Length != 1)
                    return null;
    
                return (string)Ex
    
    Richard DeemingR 1 Reply Last reply
    0
    • J JD86

      I created a class so I can add extensions to the GroupPrincipal object but I am getting this error: System.InvalidOperationException: Principal objects of type CloudPanel.AD.Custom.GroupPrincipalExt can not be used in a query against this store. at System.DirectoryServices.AccountManagement.ADStoreCtx.GetObjectClassPortion(Type principalType) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRefHelper(Type principalType, String urnScheme, String urnValue, DateTime referenceDate, Boolean useSidHistory) at System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRef(Type principalType, String urnScheme, String urnValue, DateTime referenceDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, IdentityType identityType, String identityValue) at CloudPanel.AD.Custom.GroupPrincipalExt.FindByIdentity(PrincipalContext context, IdentityType identityType, String identityValue) at CloudPanel.Exchange.ExchPs.Get_DistributionGroup(String distinguishedname) I don't really know why this isn't working since I have used this class before. Here is a piece of the class I created (I didn't include all the DirectoryProperties since there are a bunch that I've added):

      public class GroupPrincipalExt : GroupPrincipal
      {
      public GroupPrincipalExt(PrincipalContext context) : base(context) { }
      public GroupPrincipalExt(PrincipalContext context, string groupName) : base(context, groupName) { }

          public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, string identityValue)
          {
              return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityValue);
          }
      
          public static new GroupPrincipalExt FindByIdentity(PrincipalContext context, IdentityType identityType, string identityValue)
          {
              return (GroupPrincipalExt)FindByIdentityWithType(context, typeof(GroupPrincipalExt), identityType, identityValue);
          }
      
          \[DirectoryProperty("wWWHomePage")\]
          public string WWWHomePage
          {
              get
              {
                  if (ExtensionGet("wWWHomePage").Length != 1)
                      return null;
      
                  return (string)Ex
      
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Have you tried adding the DirectoryObjectClassAttribute[^] to your GroupPrincipalExt class?

      [DirectoryObjectClass("group")]
      public class GroupPrincipalExt : GroupPrincipal
      {
      ...
      }


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      J 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Have you tried adding the DirectoryObjectClassAttribute[^] to your GroupPrincipalExt class?

        [DirectoryObjectClass("group")]
        public class GroupPrincipalExt : GroupPrincipal
        {
        ...
        }


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        J Offline
        J Offline
        JD86
        wrote on last edited by
        #3

        Ahhh!! You are awesome. I copied and pasted the class and didn't copy it! That fixed it. Thank you so much :-)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups