.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

search current logged in user's information in sharepoin list

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net
 

hi guys,

in order to prepopulate some user information, i used query to search the sharepoint list. my question is how to search loggin user's info in the list.

i used following testing query function. it works fine. however, it can only search specific text, cannot be changed according different user.

SPList IsExist;
                    IsExist = SPContext.Current.Web.Lists["somelist"];
                    SPQuery query = new SPQuery();
                    
                    query.Query = @"
                        <Where>
                            <And>
                                <Eq> 
                                    <FieldRef Name='First_x0020_Name'/>
                                    <Value Type='Text'>XXX</Value> 
                                </Eq>
                                <Eq> 
                                    <FieldRef Name='Last_x0020_Name'/>
                                    <Value Type='Text'>XXX</Value> 
                                </Eq>
                            </And>
                        </Where>";
                    SPListItemCollection found = IsExist.GetItems(query);
                    


View Complete Post


More Related Resource Links

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

  
Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

How to get current logged user name using javascript ?

  
HelloI am using moss with FBA. I got following javascript to get current user login name. It is displaying curent username properly if user is belong to owner group. But whne I logged with another username who is part of member group(Contribute role), it is not displaying name. Please let me know what I am missing?In following javascript I alerted userId, it is coming in both the case <script type="text/javascript" src="/_layouts/JSAPI/SPAPI_Core.js"></script> <script type="text/javascript" src="/_layouts/JSAPI/SPAPI_Lists.js"></script> <script type="text/javascript" src="/_layouts/JSAPI/SPAPI_UserGroup.js"></script> <script type="text/javascript" src="/_layouts/JSAPI/SPAPI_UserProfile.js"></script> <script language="JavaScript"> var curTitle = null; alert(_spUserId); function getCurrentUserName() { var curUserName = null; var lists = new SPAPI_Lists('') var items = lists.getListItems( 'User Information List', '', '<Query><Where><Eq><FieldRef Name="ID"/><Value Type="Counter">' + _spUserId + '</Value></Eq></Where></Query>', // query '<

How to create a list filter like: get all list elements from the current user and all employees from

  
Hello, is it possible to filter elements by the condition mentioned in the title? Tobias

User information list properties SP Foundation 2010

  
When trying to view properties of user information list in SPD 2010, I get the following error "SharePoint designer cannot display the content of this view (...)" I am logged in as administrator for both farm and site. I can view content of the list in a browser, but I cannot access the list as a lookup column. It works with WSS 3/SPD 2007 on another server.

User information list properties SP Foundation 2010

  
When trying to view properties of user information list in SPD 2010, I get the following error "SharePoint designer cannot display the content of this view (...)" I am logged in as administrator for both farm and site. I can view content of the list in a browser, but I cannot access the list as a lookup column. It works with WSS 3/SPD 2007 on another server.

how to get current logged in user in sharepoint

  
hi im trying to get current logged in user from sharepoint site. All im getting is domain/administrator. I tried following. SPUser and delegation with elevated privilege. they are also not working for me. following is the code im working. spsite site = new spsite("some site")  spweb web = site.openweb() then im using spuser object to get the user. i went to the following link but it seems that guy was also not able to do this.... http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/4101e616-db5d-4504-ad16-169ff62269fb/   any idea... thanks Aqi

Update all Properties in the User Information List after restoring a site collection to a new domain

  

hi All

I moved a site collection (content db) from one domain to another. After the site collection was restored i ran the stsadm -o migrateuser -oldlogin -newlogin. The result was that the login id of the user in the source domain was replaced with the login in the destination domain.

However the rest of the properties in the User Information List (paricularly interested in the Email) was not updated.

How can i get all the properties in the User Information List with values in the new domain

Thanks in Advance


pv

current logged in user and password using a TSQL

  

Dear frnds,

 

 

Is there is any way to get current logged in user and password using a TSQL?  (SQL MODE)

 

 

 

Regards,

Sajid P K


How can I filter a Sharepoint 2007 libarry list based on current user login?

  

Hi all.

I would like to know how I can filter a SharePoint library list based on current user login.

Suppose I have created the followings:

1) A SharePoint form library containing bunch of uploaded InfoPath form data.

2) The InfoPath form template contains a promoted text field called "TargetUser" to store user domain login (ex: DOMAIN\JOE) and every InfoPath form file in the library has a valid domain name stored in the "TargetUser" field.

I have created a custom view for the form library and would like to filter this view so only items whose "TargetUser" field matches current user's login ID are displayed.

I went to Edit View page to customize the view and tried to use the [Me] function but I got a "Filter value is not a valid text string" message instead when clicking OK. Apparently [Me] returns a Person/Group data type and the filter cannot compare its value to that of "TargetUser".

I tried using text functions (ex: TEXT([Me],"") hoping to extract default string value from [Me]. The filter accepts the parameter without any error but the resulting fitlered list does not display any items at all.

I have googled this subject for hours but I have not found any solution.

It would be greatly appreciated if anyone can help me t

how to get current logged in user for sharepoint site

  

Hi ,

im not able to get the current logged in user for sharepoint site.

for example--if i logged in with "abc" in my system and  logged in with "pqr" on sharepoint site.
then "oWeb.CurrentUser " return the "abc" .
 but as per me..i want pqr--bez im logged in to share point site with "pqr" user.


SSRS 2008 R2 how to get the logged user Group information

  

Hi,

I am using  SSRS 2008 R2, for the windows login I am able to get the domain and user name(domain\username) by using the the built in fields User!UserID in the expression.


I had the requirement to use the Active Directory and it contains several groups and users.I have provided the permissions to the groups to browse  the reports from the site and folder settingin the report manager.Is it possible to get the groupname by any expressions  ? now I am only getting the systemname\username by User!UserID.

I have to get the groupname for which the user belong.

Thanks,
Shyam


Fetching Task List for the logged in User

  

Hi All,

The requirement is as follows..

We have some workflows which are been created already. The tasks are been assigned to users for their approval. Now, when the approver logs in it should display the Tasks List which are belonging to that particular user only. OR if the normal user logs inn, it should display Tasks belonging to that User only. A web part should display this. Pls. note that I have to show the Tasks from both "Workflow Task" & "Task".

How do I achieve the same?

Thnx,

Alex


alex

HttpContext.Current is giving wrong user information

  

Hi,

I have used IIdentity WinId = HttpContext.Current.User.Identity; to get user information for the logged in user, but out of 5 user one user is getting other user's details. please suggest me how to sort out this issue.

I am not storing this details nor i processed before displaying it, i simply get value through above line and displaying it in the message box. So no question of overwriting by cookies or any other processes.

Regards,

Jay


Fetching Task List for the logged in User with LINQ/CAML/SQL query

  

Hi All,

We have some workflows which are been created already. The tasks are been assigned to users for their approval. Now, when the approver logs in it should display the Tasks List which are belonging to that particular user only. OR if the normal user logs inn, it should display Tasks belonging to that User only. A web part should display this. Pls. note that I have to show the Tasks from both "Workflow Task" & "Task".

The Task list should come from across site collections of a Web Application.

Hence,The Scopen should be WebApplication.
How do I achieve the same? Need help ASAP.

Thnx,

Alex


alex

Task List for the logged in User with LINQ/CAML/SQL query

  

Hi All,

We have some workflows which are been created already. The tasks are been assigned to users for their approval. Now, when the approver logs in it should display the Tasks List which are belonging to that particular user only. OR if the normal user logs inn, it should display Tasks belonging to that User only. A web part should display this. Pls. note that I have to show the Tasks from both "Workflow Task" & "Task".

The Task list should come from across site collections of a Web Application.

Hence,The Scopen should be WebApplication.
How do I achieve the same? Need help ASAP.

Thnx,

Alex


alex

Fetching Task List for the logged in User with LINQ/CAML/SQL query

  

Hi All,

We have some workflows which are been created already. The tasks are been assigned to users for their approval. Now, when the approver logs in it should display the Tasks List which are belonging to that particular user only. OR if the normal user logs inn, it should display Tasks belonging to that User only. A web part should display this. Pls. note that I have to show the Tasks from both "Workflow Task" & "Task".

The Task list should come from across site collections of a Web Application.

Hence,The Scopen should be WebApplication.
How do I achieve the same? Need help ASAP.

Thnx,

Alex


alex

Id of the Current Logged In user

  

hi 

i have created a login structure  through  ASP.net Website Administration Tool

 

now to knw the current user Logged in

 

 

 

String uname = HttpContext.Current.User.Identity.Name;

 

NOW HOW TO KNW THE   "USER  ID" ??

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend