マイナーでもいいよね??

殆どVB系、でも .NET じゃない VB は知らないよん

目次

Blog 利用状況

書庫

日記カテゴリ

ドメインユーザ用のクラス(C#)

ドメインユーザを表すクラス DomainUser クラスのC#のコードです。

 

[DataObject()]

public sealed class DomainUser : DomainObject, IUser

  #region プライベートフィールド

  private readonly string _name;

  #endregion

 

  #region インターナルコンストラクタ

  //DirectoryEntry を指定して DomainUser クラスの新しいインスタンスを初期化します。

  internal DomainUser(DirectoryEntry entry)

    : base(entry)

  {

    _name = entry.Properties["sAMAccountName"].Value.ToString();

  }

  #endregion

 

  #region パブリックプロパティ

  //電子メールを取得または設定します。

  public string EmailAddress

  {

    get

    {

      if (base.IsDisposed)

      {

        throw new ObjectDisposedException(this.GetType().Name);

      }

      return (string)base.Entry.Properties["mail"].Value;

    }

    set

    {

      if (base.IsDisposed)

      {

        throw new ObjectDisposedException(this.GetType().Name);

      }

      base.Entry.Properties["mail"].Value = value;

    }

  }

//***** 長くなるので以降プロパティの Dispse チェックを省略(DisplayName と Name プロパティは元々なし)

  //アカウントが無効かどうかを取得または設定します。

  public bool Disabled

  {

    get

    {

      return ((IADsUser)base.Entry.NativeObject).AccountDisabled;

    }

    set

    {

      ((IADsUser)base.Entry.NativeObject).AccountDisabled = value;

    }

  }

 

  //表示用の名前を取得します。

  public string DisplayName

  {

    get

    {

      return base.Name;

    }

  }

 

  //名を取得または設定します。

  public string FirstName

  {

    get

    {

      return (string)base.Entry.Properties["givenName"].Value;

    }

    set

    {

      base.Entry.Properties["givenName"].Value = value;

    }

  }

 

  //表示名を取得または設定します。

  public string FullName

  {

    get

    {

      return (string)base.Entry.Properties["displayName"].Value;

    }

    set

    {

      base.Entry.Properties["displayName"].Value = value;

    }

  }

 

  //姓を取得または設定します。

  public string LastName

  {

    get

    {

      return (string)base.Entry.Properties["sn"].Value;

    }

    set

    {

      base.Entry.Properties["sn"].Value = value;

    }

  }

 

  //アカウント名を取得します。

  public override string Name

  {

    get

    {

      return _name;

    }

  }

 

  //Entry の ADSI User オブジェクトを取得します。

  public IADsUser Native

  {

    get

    {

      return (IADsUser)base.Entry.NativeObject;

    }

  }

 

  //事業所を取得または設定します。

  public string OfficeName

  {

    get

    {

      return (string)base.Entry.Properties["physicalDeliveryOfficeName"].Value;

    }

    set

    {

      base.Entry.Properties["physicalDeliveryOfficeName"].Value = value;

    }

  }

 

  //プライマリグループ ID を取得します。

  public int PrimaryGroupId

  {

    get

    {

      return Convert.ToInt32(base.Entry.Properties["primaryGroupID"].Value);

    }

  }

 

  //電話番号を取得または設定します。

  public string TelephoneNumber

  {

    get

    {

      return (string)base.Entry.Properties["telephoneNumber"].Value;

    }

    set

    {

      base.Entry.Properties["telephoneNumber"].Value = value;

    }

  }

  #endregion

 

  #region パブリックメソッド

  //指定したアカウント名のユーザを検索します。このメソッドはデータバインド用です。

  [DataObjectMethod(DataObjectMethodType.Select)]

  public static DomainUser FindByName(string name)

  {

    return (DomainUser)DirectoryAccess.FindDirectoryObject(name, CategoryType.User);

  }

 

  //指定したユーザの所属するグループを取得します。このメソッドはデータバインド用です。

  [DataObjectMethod(DataObjectMethodType.Select)]

  public static ReadOnlyCollection<string> GetBelongGroups(string userName)

  {

    var user = FindByName(userName);    //ユーザを検索

    return DirectoryAccess.GetBelongGroups(user);    //ユーザの所属するグループを取得

  }

 

  //ユーザの一覧を取得します。このメソッドはデータバインド用です。

  [DataObjectMethod(DataObjectMethodType.Select)]

  public static IList<DomainUser> GetUsers()

  {

    return DirectoryAccess.GetUsers<DomainUser>();    //ユーザを取得

  }

 

  //表示用の名前を返します。

  public override string ToString()

  {

    return this.DisplayName;

  }

  #endregion

}

 

少しですが説明はVBのコードの方に書いてます。

投稿日時 : 2013年7月10日 0:01

コメントを追加

# Heya i'm for the primary time here. I came across this board and I find It really useful & it helped me out a lot. I am hoping to give one thing again and help others like you aided me. 2021/09/03 11:04 Heya i'm for the primary time here. I came across

Heya i'm for the primary time here. I came across this board and I find
It really useful & it helped me out a lot. I am hoping to give
one thing again and help others like you aided me.

# I do not even know the way I finished up here, but I assumed this post was great. I do not realize who you might be but definitely you are going to a famous blogger when you aren't already. Cheers! 2021/09/06 0:48 I do not even know the way I finished up here, but

I do not even know the way I finished up here,
but I assumed this post was great. I do not realize who you might be
but definitely you are going to a famous blogger when you aren't
already. Cheers!

# I do not even know the way I finished up here, but I assumed this post was great. I do not realize who you might be but definitely you are going to a famous blogger when you aren't already. Cheers! 2021/09/06 0:49 I do not even know the way I finished up here, but

I do not even know the way I finished up here,
but I assumed this post was great. I do not realize who you might be
but definitely you are going to a famous blogger when you aren't
already. Cheers!

# I do not even know the way I finished up here, but I assumed this post was great. I do not realize who you might be but definitely you are going to a famous blogger when you aren't already. Cheers! 2021/09/06 0:50 I do not even know the way I finished up here, but

I do not even know the way I finished up here,
but I assumed this post was great. I do not realize who you might be
but definitely you are going to a famous blogger when you aren't
already. Cheers!

# I do not even know the way I finished up here, but I assumed this post was great. I do not realize who you might be but definitely you are going to a famous blogger when you aren't already. Cheers! 2021/09/06 0:51 I do not even know the way I finished up here, but

I do not even know the way I finished up here,
but I assumed this post was great. I do not realize who you might be
but definitely you are going to a famous blogger when you aren't
already. Cheers!

# Usually I do not read article on blogs, however I would like to say that this write-up very compelled me to check out and do it! Your writing taste has been surprised me. Thanks, quite great article. quest bars http://bit.ly/3C2tkMR quest bars 2021/09/11 19:59 Usually I do not read article on blogs, however I

Usually I do not read article on blogs, however
I would like to say that this write-up very compelled me to check out and
do it! Your writing taste has been surprised me. Thanks, quite great
article. quest bars http://bit.ly/3C2tkMR quest bars

# stromectol tablets 2021/09/28 13:08 MarvinLic

ivermectin generic name http://stromectolfive.com/# stromectol online

# This is really attention-grabbing, You are a very skilled blogger. I've joined your feed and look forward to in quest of extra of your great post. Also, I have shared your website in my social networks 2021/10/25 14:15 This is really attention-grabbing, You are a very

This is really attention-grabbing, You are a very skilled
blogger. I've joined your feed and look forward to in quest of extra of your great
post. Also, I have shared your website in my social networks

# ivermectin 1 cream generic 2021/11/03 0:31 DelbertBup

ivermectin 50 http://stromectolivermectin19.online# п»?ivermectin pills
ivermectin 80 mg

# I've been surfing on-line more than 3 hours these days, but I never found any attention-grabbing article like yours. It's beautiful value enough for me. Personally, if all website owners and bloggers made good content as you did, the net will likely be 2021/11/12 13:10 I've been surfing on-line more than 3 hours these

I've been surfing on-line more than 3 hours these days,
but I never found any attention-grabbing article like yours.
It's beautiful value enough for me. Personally, if all website owners and bloggers made good content as you did,
the net will likely be a lot more helpful than ever before.

# When someone writes an article he/she keeps the idea of a user in his/her mind that how a user can understand it. Therefore that's why this piece of writing is outstdanding. Thanks! 2021/11/16 15:37 When someone writes an article he/she keeps the id

When someone writes an article he/she keeps the idea of a user in his/her mind that how a user can understand it.
Therefore that's why this piece of writing is outstdanding.
Thanks!

# generic ed pills from canada 2021/12/04 9:08 JamesDat

https://genericpillson.com/# cheap generic ed pills cytotec

# how to take sildenafil 20 mg 2021/12/11 7:50 JamesDat

https://iverstrom24.online/# stromectol 3mg tablets

# careprost for sale 2021/12/12 7:03 Travislyday

http://plaquenils.online/ plaquenil brand name

# bimatoprost generic 2021/12/13 2:26 Travislyday

http://baricitinibrx.com/ baricitinib eua fact sheet

# bimatoprost generic https://bimatoprostrx.com
bimatoprost buy
2021/12/13 16:05 Hksfnjkh

bimatoprost generic https://bimatoprostrx.com
bimatoprost buy

# best place to buy careprost 2021/12/15 11:08 Travislyday

http://baricitinibrx.com/ baricitinib price

# buy bimatoprost 2021/12/16 6:42 Travislyday

http://baricitinibrx.com/ barikind

# ivermectin 3mg 2021/12/17 3:47 Eliastib

fiodjj https://stromectolr.com ivermectin for sale

# ivermectin new zealand 2021/12/17 23:14 Eliastib

ylsmin https://stromectolr.com ivermectin pills

# generic doxycycline https://doxycyline1st.com/
doxycycline 100mg dogs 2022/02/26 0:18 Jusidkid

generic doxycycline https://doxycyline1st.com/
doxycycline 100mg dogs

# SCwcUcDUGZZoTOae 2022/04/19 10:56 johnansaz

http://imrdsoacha.gov.co/silvitra-120mg-qrms

# lasix online https://buylasix.icu/
furosemida 40 mg 2022/06/24 16:49 LasixRx

lasix online https://buylasix.icu/
furosemida 40 mg

# clomid online purchase https://clomidonline.icu/ 2022/07/08 13:16 Clomidj

clomid online purchase https://clomidonline.icu/

# ivermectin for coronavirus mayo clinic https://stromectolbestprice.com/ 2022/07/30 0:11 BestPrice

ivermectin for coronavirus mayo clinic https://stromectolbestprice.com/

# metformin buy usa https://glucophage.top/
metformin 1 tablet 2022/08/23 7:33 Niujsdkj

metformin buy usa https://glucophage.top/
metformin 1 tablet

# new ed treatments https://ed-pills.xyz/
impotence pills 2022/09/15 18:55 EdPills

new ed treatments https://ed-pills.xyz/
impotence pills

# ed pills https://ed-pills.xyz/
best non prescription ed pills 2022/09/16 19:20 EdPills

ed pills https://ed-pills.xyz/
best non prescription ed pills

# ed meds online without doctor prescription https://ed-pills.xyz/
best drug for ed 2022/09/17 19:36 EdPills

ed meds online without doctor prescription https://ed-pills.xyz/
best drug for ed

# buy generic doxycycline https://buydoxycycline.icu/ 2022/10/08 11:44 Doxycycline

buy generic doxycycline https://buydoxycycline.icu/

# prednisone online paypal https://prednisonepills.site/
prednisone daily 2022/11/30 0:39 Prednisone

prednisone online paypal https://prednisonepills.site/
prednisone daily

# herbal ed treatment https://cheapestedpills.com/
erectile dysfunction drug 2022/12/10 16:17 CheapPills

herbal ed treatment https://cheapestedpills.com/
erectile dysfunction drug

# doors2.txt;1 2023/03/14 15:30 UNpHOharsdiZrAhqqp

doors2.txt;1

# Диктатура – власть, опирающаяся на силу, в самом прямом смысле слова. не продавая - 10 секретных способов 2023/03/28 14:49 Диктатура – власть, опирающаяся на силу, в самом п

Диктатура ? власть, опирающаяся на силу,
в самом прямом смысле слова.
не продавая - 10 секретных способов

# Диктатура – власть, опирающаяся на силу, в самом прямом смысле слова. не продавая - 10 секретных способов 2023/03/28 14:50 Диктатура – власть, опирающаяся на силу, в самом п

Диктатура ? власть, опирающаяся на силу,
в самом прямом смысле слова.
не продавая - 10 секретных способов

# Диктатура – власть, опирающаяся на силу, в самом прямом смысле слова. не продавая - 10 секретных способов 2023/03/28 14:50 Диктатура – власть, опирающаяся на силу, в самом п

Диктатура ? власть, опирающаяся на силу,
в самом прямом смысле слова.
не продавая - 10 секретных способов

# Диктатура – власть, опирающаяся на силу, в самом прямом смысле слова. не продавая - 10 секретных способов 2023/03/28 14:50 Диктатура – власть, опирающаяся на силу, в самом п

Диктатура ? власть, опирающаяся на силу,
в самом прямом смысле слова.
не продавая - 10 секретных способов

# pillole per erezioni fortissime https://viasenzaricetta.com/# 2023/04/16 13:23 ViaSenza

pillole per erezioni fortissime https://viasenzaricetta.com/#

# buy cheap doxycycline online - https://doxycyclinesale.pro/# 2023/04/21 17:25 Doxycycline

buy cheap doxycycline online - https://doxycyclinesale.pro/#

# buy prednisone canada - https://prednisonesale.pro/# 2023/04/22 4:42 Prednisone

buy prednisone canada - https://prednisonesale.pro/#

# buy cytotec - https://cytotecsale.pro/# 2023/04/29 5:00 Cytotec

buy cytotec - https://cytotecsale.pro/#

# no prior prescription needed https://pillswithoutprescription.pro/# 2023/05/16 9:55 PillsPro

no prior prescription needed https://pillswithoutprescription.pro/#

# non prescription prednisone 20mg https://prednisonepills.pro/# - buy prednisone online canada 2023/06/04 21:26 Prednisone

non prescription prednisone 20mg https://prednisonepills.pro/# - buy prednisone online canada

# ï»¿paxlovid https://paxlovid.life/# paxlovid india 2023/07/25 20:36 Paxlovid

paxlovid https://paxlovid.life/# paxlovid india

# best over the counter ed pills https://edpills.ink/# - natural remedies for ed 2023/07/27 1:09 EdPills

best over the counter ed pills https://edpills.ink/# - natural remedies for ed

# best ed treatment pills https://edpillsotc.store/# - ed meds online 2023/10/08 1:29 EdPills

best ed treatment pills https://edpillsotc.store/# - ed meds online

# acquistare farmaci senza ricetta https://farmaciait.pro/ farmaci senza ricetta elenco 2023/12/04 10:24 Farmacia

acquistare farmaci senza ricetta https://farmaciait.pro/ farmaci senza ricetta elenco

# prednisone 10mg tablet cost https://prednisonepharm.store/ buying prednisone on line 2024/01/20 17:39 Prednisone

prednisone 10mg tablet cost https://prednisonepharm.store/ buying prednisone on line

# lana rhoades unleashed - https://lanarhoades.pro/ lana rhoades videos
2024/03/06 17:54 LanaRho

lana rhoades unleashed - https://lanarhoades.pro/ lana rhoades videos

# sweetie fox https://sweetiefox.pro/ - sweetie fox full video
2024/03/06 22:14 SwitieFox

sweetie fox https://sweetiefox.pro/ - sweetie fox full video

タイトル
名前
URL
コメント