Windows Vista Forums

Object.Get vs direct retreival
  1. #1


    Tim Munro Guest

    Object.Get vs direct retreival

    Hi all, I have a question relating to object propery caches and retreival
    and update methods.



    What is the difference between let's say:

    sInfo = oUser.get("info") and
    sInfo = oUser.info?

    If the property does not exist in the cache, do they both return the
    E_ADS_PROPERTY_NOT_FOUND code?
    In each case will sinfo be "Empty" or "Null"?
    Which is the proper method to use and which is the preferred method to use?

    Similar questions for the .put method. If the property does not exist in the
    cache and you need to create it, what's the proper way to do so?

    Thanks very much
    --
    Tim.



      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: Object.Get vs direct retreival


    "Tim Munro" <Excelsior@xxxxxx> wrote in message
    news:uGjgHuOzJHA.2324@xxxxxx

    > Hi all, I have a question relating to object propery caches and retreival
    > and update methods.
    >
    > What is the difference between let's say:
    >
    > sInfo = oUser.get("info") and
    > sInfo = oUser.info?
    >
    > If the property does not exist in the cache, do they both return the
    > E_ADS_PROPERTY_NOT_FOUND code?
    > In each case will sinfo be "Empty" or "Null"?
    > Which is the proper method to use and which is the preferred method to
    > use?
    >
    > Similar questions for the .put method. If the property does not exist in
    > the cache and you need to create it, what's the proper way to do so?
    >
    > Thanks very much
    > --
    > Tim.
    >
    If you use oUser.Get("info"), an error is raised (property cannot be found
    in cache) if no value is assigned. If you use

    sInfo = oUser.info

    then sInfo will be Empty if info has no value. Otherwise, they are the same.
    If you use Get you almost need to trap errors. I seldom use it as a result.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  3. #3


    Tim Munro Guest

    Re: Object.Get vs direct retreival

    Thank you Richard.

    "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
    message news:uD4NS8OzJHA.1372@xxxxxx

    >
    > "Tim Munro" <Excelsior@xxxxxx> wrote in message
    > news:uGjgHuOzJHA.2324@xxxxxx

    >> Hi all, I have a question relating to object propery caches and retreival
    >> and update methods.
    >>
    >> What is the difference between let's say:
    >>
    >> sInfo = oUser.get("info") and
    >> sInfo = oUser.info?
    >>
    >> If the property does not exist in the cache, do they both return the
    >> E_ADS_PROPERTY_NOT_FOUND code?
    >> In each case will sinfo be "Empty" or "Null"?
    >> Which is the proper method to use and which is the preferred method to
    >> use?
    >>
    >> Similar questions for the .put method. If the property does not exist in
    >> the cache and you need to create it, what's the proper way to do so?
    >>
    >> Thanks very much
    >> --
    >> Tim.
    >>
    >
    > If you use oUser.Get("info"), an error is raised (property cannot be found
    > in cache) if no value is assigned. If you use
    >
    > sInfo = oUser.info
    >
    > then sInfo will be Empty if info has no value. Otherwise, they are the
    > same. If you use Get you almost need to trap errors. I seldom use it as a
    > result.
    >
    > --
    > Richard Mueller
    > MVP Directory Services
    > Hilltop Lab - http://www.rlmueller.net
    > --
    >
    >


      My System SpecsSystem Spec

Object.Get vs direct retreival problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting and iteration in object of type object eliassal .NET General 2 08 Jan 2010
Binding TextBox.Text to property in nested (multi levels) object withbindingsource, Error if grandchild object is NULL Efy .NET General 0 14 Oct 2009
Inherit from usercontrol - Object not set to instance of an object Nemisis .NET General 0 10 Jun 2009
Testing object arrays using Compare-Object and -contains Alex K. Angelopoulos [MVP] PowerShell 2 31 Aug 2006
Adding canonical aliases for Compare-Object, Measure-Object, New-Object Alex K. Angelopoulos [MVP] PowerShell 2 26 May 2006