Posts

Showing posts from February, 2012

Display Current Login User Name in Sharepoint 2010 Using Sharepoint Designer 2010

Image
Display the current login username in sharepoint control.We have only access to sharepoint designer. We dont have access to add serverside code.  So we decide to user "Welcome username" message. We used javascript to display the username. Please check the following code. setPickerInputElement(1); call this function, and pass the people & group No.if there is only one people & control use "1", if you have more than 1, give on which control the current username need to display. Screen1:Paste the code as shown. Screen 2: With this approach, instead of people or group control, you can display the user name in textbox if required.

Sharepoint Programming

Q) Retrieving information from linked lists in SharePoint using LINQ to SharePoint? using System.Linq; using Microsoft.SharePoint; using Microsoft.SharePoint.Linq; In the Page_Load method, add the following code: DataContext dc = new DataContext(SPContext.Current.Web.Url); var customers = dc.GetList < Customer > (“Customers”); var customerDataSource = from customer in customers select new {CustomerName = customer.Title, ContactLastName = customer.PrimaryContact.Title, ContactFirstName = customer.PrimaryContact. FirstName}; CustomerGridView.DataSource = customerDataSource; CustomerGridView.DataBind() Q)How you can retrieve the name of each folder in the top - level site of a site collection, as well as the number of subfolders that each folder contains? using System; using System.Text; using Microsoft.SharePoint; namespace Wrox.SixInOne { class Program { static void Main(string[] args) { StringBuilder folderName = new StringBuilder(); using (SPSite site =