About Me

My photo
a Dynamic and Energetic guy.....

Wednesday, December 21, 2011

SharePoint 2010 Resource Throttling

When we are heavily using SharePoint we need to increase default resources.
If any LIST is going to exceed 20,000 item limit we have to increase the default count.
1. go to "Central administration "
2. Go to web applications list
3. Select the needed web application
4. go to "General settings" on the menu bar
5. select "Resource settings"
  
 6. Set the maximum items count (List View Threshold) or maximum number of lookup fields



Tuesday, December 20, 2011

SharePoint 2010 Search return no results

1. Do a "Crawl"
2. Go to "Crawl Log"
 

3. Have a look on the "SharePoint Log"
4. It is because of "Alternative Access Mapping", SharePoint Application server can't get data from itself when ACM is enabled.

Solution
So you need to disable the LoopBackRequest in registry. To do this, just follow my instructions:

1. Go to command window and type regedit.exe
2. Once opened the registry editor, just navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa"
3. Right click on "Lsa" and create a new 32bit DWORD value
4. Rename it as "DisableLoopbackCheck" (Note: you cannot rename it actually. so, once created the DWORD value, directly paste/type as "DisableLoopbackCheck".
5. Then again modify the value of "DisableLoopbackCheck" as "1"
6. Close the registry editor.
7. Now start to crawl the content.


5. Do a Re-Crawl

SharePoint 2010 Search Advanced

1. Create a separate "Search Service Application"
2. Add SharePoint account in to "Administrator"group
3. Click on the service application
4. Go to "Content Sources"
5. Type the URLs (eg:- http://Intranet)
6. Go to "Scopes" and then Click "Edit"
7. Set the web address or content source
8. Set "Scopes"

9.Set "Scope rules"

10.Set the "Crawl Rules"
11. Crawling Full
12. Crawling Incremental
13. Go to "Crawl Log" and see the "Statistics"
14. "Crawl" success with green color icon
 

15. Filter "Crawl Items" if you have 1000+ items






Tuesday, December 6, 2011

SharePoint 2010 User Profile Sync

                  1. We have to create user profile connection in central administration
                                             2.Populate data from AD
 3.Restart User Profile Synchronization service 

4. Edit User Property (Picture property) 

5. Map with AD property (ThumbnailPhoto)

6. Start the User Profile SYNC
7.Run the powershell command
"Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://SharePoint-T02/my"


8.Verify Images in "http://Intranet/my/User Photos/"

DONE :)
Now AD user images should display in Mysite of all users.

NB:- SharePoint 2010 should be updated with SP1 to get the images from to SharePoint




Sunday, November 27, 2011

SharePoint 2010 User Profile Sync filtration

We can have a filtration to user profile sync in SharePoint 2010.
If we don't need to sync deactivated user accounts we can have a "Exclusion Filter".
We can use any attribute to reduce the load of sync.

Can't see Manage Services in SharePoint 2010

Sometimes we can't see the "Manage Services in Server"

are you puzzled???
*** Start the browser with "administrator privileges" :)

Find SharePoint 2010 Version and status of updates


Saturday, October 22, 2011

Get SharePoint Webapplication port number in 2010

1. Open a text document
2. Type the following lines

"echo Getting all SharePoint ports
pushd C:\Windows\System32\inetsrv
appcmd list wp
cd C:\Windows\System32\inetsrv
pause"


3. save as "myApps.cmd"
4. Run as Administrator

Friday, October 21, 2011

SharePoint 2010 close the popup and redirect parent

In SharePoint 2010 we have popup windows in many places.

If we need to close the PopUp and redirect the parent to a new page or reload the PopUp we can use simple code :)

Server side Code In the POPUP page
string redirectUrl = ResourceWrapper.GetAAFResource("PopupMyApprovalsLink");
Response.Write("script type='text/javascript'>window.frameElement.navigateParent('"+ redirectUrl +"'));
also we can use,
Response.Write("script type='text/javascript'>window.frameElement.commitPopup()");
to close the PopUp

Thursday, October 6, 2011

Excel Macro To Send Emails Automatically

Option Explicit

Private Sub Worksheet_Calculate()
    Dim FormulaRange As Range
    Dim NotSentMsg As String
    Dim MyMsg As String
    Dim SentMsg As String
    Dim MyLimit As Date

    NotSentMsg = "Not Sent"
    SentMsg = "Sent"

    'Above the MyLimit value it will run the macro
    MyLimit = Date   //Set The Current Date

    'Set the range with Formulas that you want to check
    Set FormulaRange = Me.Range("J6:J60") //Date Range

    On Error GoTo EndMacro:
    For Each FormulaCell In FormulaRange.Cells
        With FormulaCell
            If IsDate(.Value) = False Then
                MyMsg = "Not a date"
            Else
                If .Value < MyLimit Then
                    MyMsg = SentMsg
                    If .Offset(0, 1).Value = NotSentMsg Then
                        Call Mail_with_outlook2  //Call To Send Emails
                    End If
                Else
                    MyMsg = NotSentMsg
                End If
            End If
            Application.EnableEvents = False
            .Offset(0, 1).Value = MyMsg
            Application.EnableEvents = True
        End With
    Next FormulaCell

ExitMacro:
    Exit Sub

EndMacro:
    Application.EnableEvents = True

    MsgBox "Some Error occurred." _
         & vbLf & Err.Number _
         & vbLf & Err.Description

End Sub
=================================================
Email Sending Part
=================================================
Sub Mail_with_outlook2()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim strto As String, strcc As String, strbcc As String
    Dim strsub As String, strbody As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strto = Cells(FormulaCell.Row, "P").Value
    strcc = ""
    strbcc = ""
    strsub = "Do an update"
    strbody = "Hi " & Cells(FormulaCell.Row, "L").Value & vbNewLine & vbNewLine & _
              "Your expiry date is: " & Cells(FormulaCell.Row, "J").Value & vbNewLine & _
              "for the task of : " & Cells(FormulaCell.Row, "C").Value & _
              vbNewLine & vbNewLine & "Do an update" & _
              vbNewLine & vbNewLine & "Thanks." & _
              vbNewLine & vbNewLine & "Regards," & _
              vbNewLine & vbNewLine & "Marina Samaratunge"

    With OutMail
        .To = strto
        .CC = strcc
        .BCC = strbcc
        .Subject = strsub
        .Body = strbody
        'You can add a file to the mail like this
        '.Attachments.Add ("C:\test.txt")
        .Display    ' or use .Send
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

Wednesday, September 14, 2011

SharePoint 2010 permission levels

              
Permission Levels
1.       Full
2.       High
3.       WSS_Medium
4.       Medium
5.       Low
6.       WSS_Minimal (Default security level that comes with SharePoint)
7.       Minimal
Things that we can do when do custom development
   1. Raise the trust level of the application
   2. GAC your assemblies (so that they run in full trust and get the permissions needed)
   3. Put the assemblies in to ‘Bin’ folder and create a custom policy file, refer it in web.config file

Create SharePoint search results using FullTextSqlQuery

            DataTable search = new DataTable();
            using (SPSite site = new SPSite(SPContext.Current.Web.Site.Url))
            {
                SearchQueryAndSiteSettingsServiceProxy settingsProxy = SPFarm.Local.ServiceProxies.GetValue();
                SearchServiceApplicationProxy searchProxy = settingsProxy.ApplicationProxies.GetValue("Search Service Application");

                FullTextSqlQuery query = new FullTextSqlQuery(searchProxy);

                query.QueryText = "SELECT FirstName,LastName ,AccountName,WorkPhone,UserName,PreferredName,AboutMe,NationalityP,NationalityS FROM SCOPE() WHERE \"Scope\"='People' ";
                query.ResultTypes = ResultType.RelevantResults;
                query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;
                query.KeywordInclusion = KeywordInclusion.AllKeywords;

                ResultTableCollection results = query.Execute();
                if (results.Count > 0)
                {
                    ResultTable relevant = results[ResultType.RelevantResults];
                    search.Load(relevant);

                    // serialize DataTable to XML
                    StringBuilder resultsXml = new StringBuilder();
                    using (StringWriter sw = new StringWriter(resultsXml))
                    {
                        search.WriteXml(sw);
                        sw.Flush();
                    }

                    // move XML to the XmlDataSource
                    XmlDataSource xds = new XmlDataSource();
                    xds.EnableCaching = false;
                    xds.Data = resultsXml.ToString();
                }
            }

Create SharePoint search results programatically

private void ComplexSearch()
        {
            SearchQueryAndSiteSettingsServiceProxy settingsProxy = SPFarm.Local.ServiceProxies.GetValue();
            SearchServiceApplicationProxy searchProxy = settingsProxy.ApplicationProxies.GetValue("Search_Service_CUSTOM");
            KeywordQuery keywordQuery = new KeywordQuery(searchProxy);
            string SearchScope = "PEOPLE";
            keywordQuery.HiddenConstraints = "scope:" + "\"" + SearchScope + "\"";

            keywordQuery.TrimDuplicates = true;
            keywordQuery.EnableStemming = true;
            keywordQuery.IgnoreAllNoiseQuery = true;
            keywordQuery.QueryText =  "SELECT AccountName,PreferredName,PictureUrl,WorkEmail,JobTitle,Department,InternalNumber,OfficeNumber,AboutMe,Responsibility,Skills,HitHighlightedSummary,InternalTelephone,OfficeNumber,AboutMe,Responsibility,Skills,HitHighlightedSummary,HitHighlightedProperties,CollapsingStatus,Path,FirstName,LastName FROM Scope() WHERE ('scope'='People')";


            keywordQuery.EnablePhonetic = true;           
            keywordQuery.ResultsProvider = SearchProvider.Default;
            keywordQuery.ResultTypes = ResultType.RelevantResults | ResultType.SpecialTermResults ;
            ResultTableCollection resultsTableCollection = keywordQuery.Execute();
            ResultTable searchResultsTable = resultsTableCollection[ResultType.RelevantResults];
            DataTable resultsDataTable = new DataTable();
            resultsDataTable.TableName = "Results";
            resultsDataTable.Load(searchResultsTable, LoadOption.OverwriteChanges);

            DataView view = new DataView(resultsDataTable);
            SearchGrid.DataSource = resultsDataTable;
            SearchGrid.DataBind();
        }

Wednesday, August 31, 2011

SharePoint Credential Popup disabling

It was a so much trouble to me when working SharePoint to give "Credentials" always. Even we are not thinking about it, it takes considerable amount of time. So i have decided to avoid from it. 

Internet Explorer --> Internet Options --> Security --> Trusted Sites --> User authentication


Wednesday, August 17, 2011

How to Open a DataSet using Microsoft Excel in a web application

protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            DataSet ds = CurrentApproverService.GetReportData(depID, UserID);

            DataGrid dg = new DataGrid();
            dg.DataSource = ds;
            dg.DataBind();

            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=" + "ReportData.xls");
            Response.ContentType = "application/excel";
            System.IO.StringWriter sw = new System.IO.StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            dg.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

            dg = null;
            dg.Dispose();
        }

Monday, August 8, 2011

How SharePoint 2010 Installation creates SQL Sever DataBases

I was able to get step by step screen shots of,
SharePoint 2010 installation Vs. SQL Server DB creation

                                                      (1) Initial DB structure


(2) While SharePoint 2010 Installing

(3) Step 3 of  "SharePoint 2010 product configuration" is the main step that creates "Config" database

(4)  When "Configure SharePoint Farm" using Central Administration

(5) SQL DB structure while running wizard

(6) After Configured All Services in "SharePoint 2010"
It is Easy And Structured :)


Localization in SharePoint

It was a horrible week for me, because of a too critical task, i.e.LOCALIZATION

Finally i was able to do it :) :) :)

*** Added "ChanaApp.resx" to App_GlobalResources folder in [Port] folder
*** Added "ChanaApp.nl.resx" to same folder
*** Added a label to .ASPX page
*** Set the Expression of the label, set the TEXT property using "Resources"

*** If only one page we can use
 protected override void InitializeCulture()
        {
            string[] languages = HttpContext.Current.Request.UserLanguages;
            string language = languages[0].ToLowerInvariant().Trim();

            string selectedLanguage = language;
            Thread.CurrentThread.CurrentCulture =
                CultureInfo.CreateSpecificCulture(selectedLanguage);
            Thread.CurrentThread.CurrentUICulture = new
                CultureInfo(selectedLanguage);
            base.InitializeCulture();
        }

*** If for total web application then we have to use
protected void Application_BeginRequest(object sender, EventArgs e)
        {
            string[] languages = HttpContext.Current.Request.UserLanguages;
            string language = languages[0].ToLowerInvariant().Trim();
            string selectedLanguage = language;
            Thread.CurrentThread.CurrentCulture =
                CultureInfo.CreateSpecificCulture(selectedLanguage);
            Thread.CurrentThread.CurrentUICulture = new
                CultureInfo(selectedLanguage);
        }
in GLOBAL.ASAX file.
*** Change the Culture of browser will change the TEXT in the label

Saturday, July 9, 2011

Enable "Master Page" in a team site


We cant see "Master Page" in Look and Feel section

Enable "Site Collection" feature


Enable "Site" feature

Now we can see "Master Page" under "Look and Feel" section


Monday, June 27, 2011

Download SharePoint 2010 Pre-Requisites

Microsoft SQL Server 2008 Native Client Download Here
Hotfix for Microsoft Windows (KB976462) Download Here
Windows Identity Foundation (KB974405) Download Here
Microsoft Sync Framework Runtime v1.0 (x64) Download Here
Microsoft Chart Controls for Microsoft .NET Framework 3.5 Download Here
Microsoft Filter Pack 2.0 Download Here
Microsoft SQL Server 2008 Analysis Services ADOMD.NET Download Here
Microsoft Server Speech Platform Runtime (x64) Download Here
Microsoft Server Speech Recognition Language – TELE(en-US) Download Here
SQL 2008 R2 Reporting Services SharePoint 2010 Add-in Download Here

Microsoft Office 2010 Filter Packs for SharePoint


The Microsoft Filter Pack is a single point-of-distribution for Office IFilters. IFilters are components that allow search services to index content of specific file types, letting you search for content in those files. They are intended for use with Microsoft Search Services (Sharepoint, SQL, Exchange, Windows Search). 
The Filter Pack includes:

* Legacy Office Filter (97-2003; .doc, .ppt, .xls)
* Metro Office Filter (2007; .docx, .pptx, .xlsx)
* Zip Filter
* OneNote filter
* Visio Filter
* Publisher Filter
* Open Document Format Filter

Thursday, June 23, 2011

SharePoint 2010 People Picker Programatically

PeopleEditor peoplePick = new PeopleEditor();

        protected override void CreateChildControls()
        {
           
            peoplePick.AllowEmpty = false;
            peoplePick.AllowTypeIn = true;
            peoplePick.BrowseButtonImageName = "Search";
            peoplePick.CheckButtonImageName = "Validate User";
            peoplePick.ErrorMessage = "No Names Found";
            tdPeoplePicker.Controls.Add(peoplePick);
            //this.Controls.Add(peoplePick);
            base.CreateChildControls();
        }

    protected void btnSave_Click(object sender, EventArgs e)
        {           
            foreach (string ent in peoplePick.CommaSeparatedAccounts.Split(','))
            {
                if (ent.Length > 0)
                {
                    PeerReviewGroup_Employee objPeerEmp = new PeerReviewGroup_Employee();
                    objPeerEmp.EmpID = Utility.GetNullableInt(GetSelectedUserIDsByName(ent));
                    objPeerEmp.GroupID = int.Parse(ddlPeerGroup.SelectedValue);

                    PeerReviewGroup_EmployeeService.Save(objPeerEmp);
                }
            }
           
        }

Monday, April 25, 2011

How to kill a remote session using command


Step 1. Gain enough privilege to kill RDP connection on the server.
net use \\servername_or_IP /USER:username “password“

Step 2. List the connection to a particular server and get session ID.
query session /server: servername_or_IP

Step 3.  Reset the session which you don’t need using ID of the session got from previous step
reset session [sessionID] /server:servername_or_IP

Monday, April 11, 2011

Configure Drop-off Library in SharePoint 2010

Sometimes we need to have a common place to upload documents by a clerk & store data in correct data repository without his/her intervention. we can have a "Drop Off Library" and created "Rule", then documents will be stored relevant document library. we don't have to give permission for different users to upload documents to different libraries. It is with SharePoint 2010 :)







Finally we can see, the uploaded document is stored in "SDB Quotations" library. No copy is maintained in "Drop Off Library" . It is simple :)

Wednesday, April 6, 2011

SharePoint 2010 Recycle bin settings

There are 2 types of recycle bin in SharePoint. Even user deletes an item it will be stored in "Recycle Bin" of admin's. We can set a time period to keep those files in Admin's recycle bin. We can give a quota to recycle bin of normal users as well as admins.
It is also possible to set maximum file size that can be stored in SharePoint. Since all data stored in DB, it is recommended to store medium size files in SharePoint.

Wednesday, March 16, 2011

Configuring SharePoint 2010 in a Farm environment for Development


(1)    Creating hyper-v machines
a.       Create a hyper-V machine with Windows server 2008 R2
b.      After installation is completed install service pack(s) if any
c.       Go to à /Windows/System32 àSearch “sysprep.exe”
d.      Run it  and select “Shutdown options” in the dropdown
e.      Get a copy of .vhd file & save it for future use as a BASE DISK
(2)    Configure a new “AD server” using BASE DISK
(3)    Create a new “SQL server” using BASE DISK
(4)    Add “SQL server” to AD
(5)    Configure SQL server 2008 R2 64 bit
a.       Install it with native mode
b.      Add “AD admin” user group when installing SQL
(6)    Install latest service pack (if any)
(7)    Create “SharePoint server” using BASE DISK
(8)    Adding server to AD
(9)    Check network configuration of ALL servers
a.       All servers in 1 domain
b.      IP address in static mode
c.       DNS of servers match with IP of AD server IP

(10)Disable firewall in all servers before link each servers
(11)Install SharePoint foundation 2010 pre-requisites
a.       Web Server (IIS) role
b.      Application Server role
c.       Microsoft .NET Framework version 3.5 SP1
d.      SQL Server 2008 Express with SP1
e.      Microsoft Sync Framework Runtime v1.0 (x64)
f.        Microsoft Filter Pack 2.0
g.       Microsoft Chart Controls for the Microsoft .NET Framework 3.5
h.      Windows PowerShell 2.0
i.         SQL Server 2008 Native Client
j.        Microsoft SQL Server 2008 Analysis Services ADOMD.NET
k.       ADO.NET Data Services Update for .NET Framework 3.5 SP1
l.         A hotfix for the .NET Framework 3.5 SP1 that provides a method to support token authentication without transport security or message encryption in WCF.
m.    Windows Identity Foundation (WIF)
(12)Run 10 step SharePoint technology wizard
(13)Install TFS
a.       Use a domain admin account to install TFS
b.      Use “Network Service” as service account when configure TFS
c.       RAM in TFS server should be > 2 GB
d.      Firewall should be disabled
(14)Accounts that used
a.       SQL == ESPMS\admin
b.      SharePoint install = ESPMS\administrator
c.       SharePoint wizard == ESPMS\spfarmadmin

Thursday, February 24, 2011

Complex LINQ query with outer joins and customized columns


using (VonQuestDBDataContext context = new VonQuestDBDataContext())
            {
                var lines =
                    from P in context.VQPlayers
                    join T in context.VQPlayerTippings on P.VQPlayerID equals T.VQPlayerID into T_t
                    from T in T_t.DefaultIfEmpty()
                    join MT in context.MatchTeams on T.MatchTeamID equals MT.MatchTeamID into T_mt
                    from MT in T_mt.DefaultIfEmpty()

                    join G in context.VQGames on P.VQGameID equals G.VQGameID into T_g
                    from G in T_g.DefaultIfEmpty()

                    join Te in context.Teams on MT.TeamID equals Te.TeamID into T_te
                    from Te in T_te.DefaultIfEmpty()

                    join U in context.Users on P.UserID equals U.UserID into T_u
                    from U in T_u.DefaultIfEmpty()

                    join Mate in context.Matches on MT.MatchID equals Mate.MatchID into T_Mate
                    from Mate in T_Mate.DefaultIfEmpty()

                    join R in context.Rounds on Mate.RoundID equals R.RoundID into T_r
                    from R in T_r.DefaultIfEmpty()

                    where (G.VQGameID == vqGameID && R.RoundID==roundID
                    orderby P.VQPlayerID

                    select new { User = U.UserName, MatchID = Mate.MatchID == null ? "" : Mate.MatchID.ToString(), ChosenTeam = Te.TeamName == null ? "(NONE)" : Te.TeamName, };

                dgvTippings.DataSource = lines;

                dgvTippings.Columns[0].HeaderText = "User Name";
                dgvTippings.Columns[1].HeaderText = "Match ID";
                dgvTippings.Columns[2].HeaderText = "Chosen Team";
            }

My Masters