How to get count of group of current login user if AD Group is added in SharePoint Group?

My Client has 2 SharePoint Application. For the AD Users they have created AD Group and added users in that AD Group as per requirement. Later AD Group is added in SharePoint Group. When I'm trying to fetch Current User Group count, I can able to get the
count of Groups using below statement.
int groupCount = SPContext.Current.Web.CurrentUser.Groups.Count;
Above Statement, returns always 0 value if I tried with User who are added in AD Group and if I add AD User and then it will return the exact count.
Please suggest solution to get Count of Group of Current User. My Application contains more than 60 SharePoint group.

Hello,
I believe your code doesn't count those AD group users until they login at least once. If this is the case then try to use "SPUtility.GetPrincipalsInGroup" as suggested in below post:
http://stackoverflow.com/questions/4314767/getting-members-of-an-ad-domain-group-using-sharepoint-api
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • Indesign CS3: How to get the number of the current layer?

    Hallo!
    How to get the number of the current layer in a page?
    Thanks,
    Alois Blaimer

    InterfacePtr<ILayerList> layerList(documentUIDRef, UseDefaultIID());          <br /><br />int32 layerCount = layerList->GetCount();<br /><br />To findout layer name use<br /><br />IDocumentLayer* documentLayer = layerList->QueryLayer(layerIndex);<br />                         <br />PMString layer=documentLayer->GetName();

  • How to get the number of files currently open?

    hi,
    does any one know how to get the number of files currently open in windows OS?
    e.g. lets say .txt files...
    any comment will be really appreciated.
    thanks

    Assuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
    http://www.sysinternals.com/ntw2k/freeware/handle.shtml
    - K

  • [CS3][JS] How to get the file type of current document

    Hi,
    How to get the file type of current opening document (e.g., tif, jpeg, png) using JavaScript with Photoshop CS3.
    I am using file object the open the files one by one in the folder (the files sometimes don't have the extensions).
    If the current document is in tiff format then I need to convert to 8-bit, if its an Jpg image then needs to ignore the file.
    Regards,
    Karthik

    Do you really need to know the file type? What about just checking the bit depth?
    var doc = activeDocument;
    if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) {//Not 8 bit
    doc.bitsPerChannel = BitsPerChannelType.EIGHT;
    //do your save etc
    }else{
        //Ignore

  • How to get the name of the current tab.

    Hi Experts,
    I have two tabs in my tab strip and a button common to both the tabs.Can you please let me know how to get the name of the current tab in the event method of the push button.
    Thanks in advance.
    Regards,
    Arun

    1.Declare an Action for OnSelect event of Tabstrip. This event is triggered whenever any change in tab occurs.
    2. Declare an Import Parameter in this method
       Tab type String.
    3. This parameter has value of the selected TAB.
    4. You can set this value in some Attribute in Attribute Tab in this event only (OnSelect):
         wd_this->Att  = Tab.
    Att is the attribute created by you in Attributes Tab of View. ( of type String)
    5. Now the selected Tab ID is stored in this Attribute Att.
    6. In the Onaction of Button , retrieve the selected tab value from this attribute using :
               Data : lv type string.
                lv =  wd_this->Att
    Now lv has your selected TAB ID.
    I hope it would help you.
    Edited by: Saurav Mago on Oct 13, 2009 2:22 PM

  • How to get count of rows for a table?

    Hi,
    How to get count of rows for a table and secondly, how can i have access to a particular cell in a table?
    Regards,
    Devashish

    Hi Devashish,
    WdContext.node<Your_node_name>().size() will give you the no: of rows.
    This should be the node that is bound to the table's datasource property.
    WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value); will select the row at that particular index.
    You can access an attribute of a particular row as
    WdContext.node<Your_node_name>().get<node_name>ElementAt(index_value).get<attribute_name>();
    Hope this helps,
    Best Regards,
    Nibu.
    Message was edited by: Nibu Wilson

  • How to get count,index and compare to arraylists

    hi
    how to get count,index and comparing of 2 arraylist.... plz suggest me asap...

    How is your question related to JDBC? And what have you done so far with your code?

  • Urgent : how I get tree type group total result

    hi master
    sir now system give me this type for result
    PARENT ACCID DRBAL CRBAL
    K1
    K11
    11 K1101 46291132
    11 K1102 13182173
    11 K1103 23784045
    11 K1104
    11 K1105
    11 K1106
    11 K1107 10001795
    11 K1108 9083529
    11 K1109
    11 K1110 4224350
    11 K1111
    11 K1112 6696832
    11 K1113 7963381
    11 K1114 742766
    1 K12
    12 K1201 1486082
    12 K1202
    12 K1203
    1 K13
    13 K1301
    1301 K130101
    1301 K130102
    1301 K130103
    1301 K130104 1977616
    1301 K130105
    1301 K130106 736266
    1301 K130107 396673
    1301 K130108 42751
    1301 K130109 298362
    1301 K130110 187696
    1301 K130111 537
    1301 K130112 942
    1301 K130113 987
    1301 K130114 1272
    1301 K130115 40000
    13 K1302
    1302 K130201
    1302 K130202
    1302 K130203
    1302 K130204
    1302 K130205 259941
    13 K1303
    1303 K130301
    1303 K130302
    1303 K130303 177716
    13 K1304
    1304 K130401
    1304 K130402
    1304 K130403
    1304 K130404
    1304 K130405
    1304 K130406 809719
    1304 K130407
    1304 K130408 1786091
    13 K1305
    1305 K130501
    1305 K130502
    13 K1306
    1306 K130601
    13 K1311
    1311 K131101 788780
    K2
    2 K21
    21 K2101
    2101 K210101
    2101 K210104
    21 K2102
    2102 K210201
    2102 K210202
    22 K2205
    2205 K220501
    2205 K220502
    220502 K22050201
    220502 K22050202
    220502 K22050203
    220502 K22050204
    22 K2206
    2206 K220601
    2206 K220602
    but sir i need this type of result
    PARENT ACCID DRBAL CRBAL
    GROUP NAME K1
    GROUP NAME K11
    11 K1101 46291132
    11 K1102 13182173
    11 K1103 23784045
    11 K1104
    11 K1105
    11 K1106
    11 K1107 10001795
    11 K1108 9083529
    11 K1109
    11 K1110 4224350
    11 K1111
    11 K1112 6696832
    11 K1113 7963381
    11 K1114 742766
    TOTAL
    1 K12
    TOTAL
    GROUP NAME
    12 K1201 1486082
    12 K1202
    12 K1203
    TOTAL
    1 K13
    13 K1301
    1301 K130101
    1301 K130102
    1301 K130103
    1301 K130104 1977616
    1301 K130105
    1301 K130106 736266
    1301 K130107 396673
    1301 K130108 42751
    1301 K130109 298362
    1301 K130110 187696
    1301 K130111 537
    1301 K130112 942
    1301 K130113 987
    1301 K130114 1272
    1301 K130115 40000
    13 K1302
    1302 K130201
    1302 K130202
    1302 K130203
    1302 K130204
    1302 K130205 259941
    13 K1303
    1303 K130301
    1303 K130302
    1303 K130303 177716
    13 K1304
    1304 K130401
    1304 K130402
    1304 K130403
    1304 K130404
    1304 K130405
    1304 K130406 809719
    1304 K130407
    1304 K130408 1786091
    13 K1305
    1305 K130501
    1305 K130502
    13 K1306
    Sir I need total group by group father group total and child group total
    Please help me how I get tree type group total result

    Hi master
    thankyou for your reply
    Sir,
    i know and you see my working i get code form master table and get detal amount form other table
    I have two table see table
    Acctab               Baltab
    PARENT           PCID
    CHILD           title
    PCID           amount
    I need heretical result use this type of query but not success
    please see my query and give me idea how I get here full tree
    select test.child,test.pcid,baltab.pcid from (select acctab.child,acctab.parent,acctab.pcid
    from acctab
    start with acctab.parent is null
    connect by prior acctab.child= acctab.parent) test,baltab
    where test.pcid=baltab.pcid ;
    CHILD PCID PCID
    1 1 1
    2 2 2
    3 3 3
    11 111 111
    12 112 112
    13 113 113
    21 221 221
    22 222 222
    23 223 223
    31 331 331
    32 332 332
    33 333 333
    but I need this type result
    CHILD PCID
    1 1
    11 111
    12 112
    13 113
    2 2
    21 221
    22 222
    23 223
    3 3
    31 331
    32 332
    33 333

  • How to get version of JRE on current machine in programming

    Hi, all
    Please help me how to get version of JRE on current machine,
    thanks many

    depending on what exactly you want to know:
    System.getProperty("java.version")
    System.getProperty("java.vendor")
    System.getProperty("java.vm.version")
    System.getProperty("java.vm.vendor")
    System.getProperty("java.vm.name")
    Nick.

  • How to get services which are running currently

    How to get services which are running currently in the system by a java program. And also how to write a service so that i can start/stop the service from the control panel -> services.

    triple post
    http://forum.java.sun.com/thread.jsp?forum=31&thread=364090&start=0&range=15#1532232
    http://forum.java.sun.com/thread.jsp?forum=31&thread=364088&tstart=0&trange=15

  • How to get the intersection of two arraylist containing user defined obj??

    How to get the intersection of two arraylist containing user defined obj??
    I can easily get the intersection of two array list which containing some simple class(Integer, String). But how to get the intersection of two arrayList which contain user defined object?
    Here is the sample code..I can not run this out...anybody can help me? thank you very much..
    The correct result should be like this:
    2
    2
    but I can only get this:
    2
    0
    import java.util.*;
    public class testRetain{
         public static void main(String[] args){
              ArrayList a = new ArrayList();
              ArrayList b = new ArrayList();
              a.add( new dog(1,2,2) );
              a.add( new dog(1,2,1) );
    System.out.println(a.size() );
              b.add( new dog(1,2,2) );
              a.retainAll(b);
    System.out.println(a.size() );
    class dog implements Comparable{     
         int head;
         int arms;
         int legs;
         dog(int head, int arms, int legs){
              this.head = head;
              this.arms = arms;
              this.legs = legs;
         public int compareTo(Object o){
              if ( ((dog)o).head > this.head )
                   return -1;
              else if ( ((dog)o).head < this.head )
                   return 1;
              else
                   return 0;
    }

    @Op. Your classes should override equals and hashCode
    Kaj

  • How to get a organization name for a particular user using API's

    Hi alll,
    How to get a organization name for a particular user using API's

    You need to do something like this:
    SearchCriteria criteria = new SearchCriteria("User Login", "XELSYSADM", SearchCriteria.Operator.EQUAL);
                   UserManager usrService = oimClient.getService(UserManager.class);
                   Set<String> retAttrs = new HashSet<String>();
                   retAttrs.add(UserManagerConstants.AttributeName.USER_ORGANIZATION.getId());
                   List<oracle.iam.identity.usermgmt.vo.User> users = usrService.search(criteria, retAttrs, null);
                   System.out.println("ORG KEY :: " + users.get(0).getAttribute("act_key"));

  • How to fetch the current login user name at the BI system

    Hi,
    In our scenerio we need a query to fetch the current login user name at the BI system. Would you please suggest the possibilities?
    Thanks and regards,
    Pradip

    Hi,
    The current login id will be available in text elements of query.
    Regards
    Akhan

  • How to hide the Columns and Views for Login user in SharePoint 2013

    Hi Friends,
    How to hide the Columns and Views for Login user in SharePoint 2013? Is it possible using OOB features? If not possible how can we hide the Columns and Views for Login user?
    Could you please help on this.
    Thanks,
    Tiru
    Tiru

    Hello Tirupal,
    There is no OOB way to do this.
    Please check this codeplex solution to achieve the same.
    https://sp2013columnpermission.codeplex.com/
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • How to get count for missing month

    I created a view as follows:
    CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS
    select "MONTH","COUNT" from (
    select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506', '507', '508', '509', '510')
    group by to_char(pdate,'Mon-yyyy'))
    order by to_date(month,'Mon-yyyy')
    Some months are missing in the view. I want to put that month and 0 in the view. How to do it?
    Thanks,
    Jennifer

    Hi, Jennifer,
    You need to outer-join to some table or result set (such as all_months, below) that has one roe per month.
    Here's one way:
    CREATE OR REPLACE FORCE VIEW Vinfection1 (month, month_s, cnt) AS
    WITH    all_months     AS
         SELECT  ADD_MONTHS (first_month, LEVEL - 1)     AS month
         FROM     (
                  SELECT  TRUNC (MIN (pdate), 'MONTH')     AS first_month
                  ,         TRUNC (MAX (pdate), 'MONTH')     AS last_month
                  FROM    surproc
         CONNECT BY     LEVEL <= 1 + MONTHS_NETWEEN (last_month, first_month)
    SELECT  a.month
    ,     TO_CHAR (a.month, 'Mon-yyyy')     AS month_s
    ,     COUNT (*)                 AS cnt
    FROM              all_months      a
    LEFT OUTER JOIN      (     surproc               s
                   JOIN   diagnosis_surproc      d  ON   s.surprocid     = d.surprocid
                                          AND  d.diagnosisid     IN ('506', '507', '508', '509', '510')
               )     ON  a.month     = TRUNC (s.pdate)
    GROUP BY  a.month
    /Avoid table- and column names that are non-standatrd (such as names that need double-quotes), or are built-in function names (such as COUNT).
    Don't use ORDER BY in a view. Almost anything you do with the view will cause the ordering to be lost anyway.
    Even if you do have an ORDER BY clause in the view, you'll often want to ORDER BY month. Rather than call TO_DATE whenever you need to sort, I suggest having two month columns; month (whcih is a DATE) for sorting, filtering and joining, and month_s (whcih is a VARCHAR2) for displaying.
    Use ANSI join syntax, especiallly for outer joins.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Mar 20, 2012 12:03 PM
    Added outer join condition

Maybe you are looking for

  • How do I find the IP address of drive connected to LAN port?

    I connected a network drive to the LAN port of my AEBS. It appears as a Shared Device but I need to find out its assigned IP address so I can configure it. I looked in Airport Utility but can't find a listing of IP addresses that have been assigned.

  • Trouble with session variables

    Hello, I am a user of cf for a number of years, but only lately as of last week have I had the opportunity to work with CF 8.... wow the changes are quite intimidating. But none the less press on is my thought, so now my trouble. Thing I did was to s

  • Order Management Sublines

    Hi all, How do we define the sublines under the line info in Order Management Order Number-->Line -->Sublines.Anybody help me regarding on this. Thanks in advance

  • How do you Restore Stickies in Time Machine Mavericks 10.9.3?

    i lost an important note on stickies. And i retrieved an old version of it in time machine under preferences / widgets. but the setup appears to have changed in my upgrade to mavericks and I can't open the note. I'm trying to open a "post-mavericks"

  • Does Access key required to implement explicit Enhancement point

    Hi All, Does Access key required to implement explicit Enhancement point in Function module or source code or etc. please clarify.. thanks Bhanu