File Owner

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Qkh6MDA=?=

    #1

    File Owner

    I see that I can identify a files owner in windows explorer, hpw do I get
    that information using VB.net
  • Herfried K. Wagner [MVP]

    #2
    Re: File Owner

    "BHz00" <BHz00@discussi ons.microsoft.c omschrieb:
    >I see that I can identify a files owner in windows explorer, hpw do I get
    that information using VB.net
    \\\
    Imports System.IO
    Imports System.Security .Principal
    ....
    Dim Owner As String = _
    File.GetAccessC ontrol(<path>). GetOwner(GetTyp e(NTAccount)).V alue
    ///

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Andrew Thompson

      #3
      Re: File Owner

      On Dec 4, 8:34 pm, "Andrew Morton" <a...@in-press.co.uk.inv alid>
      wrote:
      ....
      (watch forline-wrap)
      Here is a small tool designed to help higlight when lines will wrap.
      <http://www.physci.org/twc.jnlp>

      --
      Andrew T.
      PhySci.org

      Comment

      • Andrew Morton

        #4
        Re: File Owner

        BHz00 wrote:
        The function gives me a NullReferenceEx ception was unhandled - Use the
        "new" keyword to create an object instance when used in the following
        code:
        [Always] use Option Strict On at the top of your code - it will alert you to
        problem areas.

        For example, your sTotalSize variable should be an Int64 ("Long").

        Andrew


        Comment

        • Cor Ligthert[MVP]

          #5
          Re: File Owner

          Andrew,
          >
          [Always] use Option Strict On at the top of your code - it will alert you
          to problem areas.
          >
          I am glad you wrote [Always] as you did, for learning the syntax it is not
          bad to set it off, when your class is then as you think it can be, you can
          set it to On. (And for your final version you have of course it forever to
          ON)

          Just to let people not think why was this in past not done by default (you
          can set it as default in your options to). You know this of course, however
          for others who read your message.

          Cor

          Comment

          • =?Utf-8?B?Qkh6MDA=?=

            #6
            Re: File Owner

            Sorry about the wrap. I had the owner sort of working. I could get the owner
            of a specific file, but not for every file in a directory. I then realized
            that the files crashing the program give something that is not recognized as
            a valid file owner. Is there a way figure this out before it causes the an
            operating problem?

            "Andrew Thompson" wrote:
            On Dec 4, 8:34 pm, "Andrew Morton" <a...@in-press.co.uk.inv alid>
            wrote:
            ....
            (watch forline-wrap)
            >
            Here is a small tool designed to help higlight when lines will wrap.
            <http://www.physci.org/twc.jnlp>
            >
            --
            Andrew T.
            PhySci.org
            >

            Comment

            Working...