.NET King technical and support webloghttp://www.dotnetking.com/TechnicalArchive.aspx.NET King RSS FeedEnglishSaturday, July 22, 2017Sat, 17 Mar 2007 19:43:06 GMT.NET King RSS Service1972Adding and removing fields in SharePoint list using Client Side Object Model CSOM 101 - Part 3 - [Technical]You create a SharePoint list and now you need to make some adjustments to the list. In this video you will see how to add or remove fields to the SharePoint list

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=388Jan 04, 2017
Adding and removing lists to SharePoint site using client side object model CSOM 101 - Part 2 - [Technical] ]]>http://www.dotnetking.com/TechnicalComments.aspx?LogID=387Oct 18, 2016SharePoint Client Side Object Model tutorial - Part 1 - [Technical] This specific video includes an overview of CSOM using C# and explains references and main .NET objects used to make a simple Windows application that connects to SharePoint 2013/2016.
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=386Oct 16, 2016
How to use CAML query in SharePoint Clinet Side Object Model - [Technical]It has been my passion these days to work on CAML query. This passion has produced 7 videos so far. This video that I published last night shows you how to query a SharePoint list using CAML query and CSOM (Client Side Object Model).

Enjoy
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=385Apr 28, 2016
How to use CAML query on Lookup fields in SharePoint 2013 - [Technical]In this video I present and demo how you can write a CAML query to filter the SharePoint list item based on Value and Key in a lookup field

Enjoy
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=384Apr 24, 2016
Working with DateTime field in CAML Query - [Technical]This video covers the use of CAML query filtering SharePoint Date field.

Keywords: DateTime, Today, OffsetDays, IncludeTimeValue

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=383Apr 20, 2016
How to create a SharePoint External list from SQL Server using Business Data Connectivity Services and Secure Store Service - [Technical]In this video you will see how to create a SharePoint 2013 external list based on the data from remote SQL Server database using SQL Authentication, Secure Store Service and Business Data Connectivity Service.

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=382Apr 18, 2016
How to use CAML query on SharePoint text fields (Equals, Contains, Begins With) - [Technical] - Simple CAML Query structure
- Searching for exact string (Equals)
- Searching for part of the string (Contains)
- Searching for text starting with search string (Begins With)
- Searching for Less than or Greater than search string
- Combining search conditions (And/Or)
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=381Apr 12, 2016
Using C# and CAML to query the list items in SharePoint - SPQuery - [Technical] In this video I start a series of CAML query tutorial and I reveal lots of tips and tricks to build efficient CAML queries.
Here is the first video... Enjoy
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=380Apr 08, 2016
Accessing SharePoint user fields programmatically using C# - [Technical]]]>http://www.dotnetking.com/TechnicalComments.aspx?LogID=379Apr 02, 2016Assigning master page to a SharePoint 2013 site programmatically (Client Side Object Model) - [Technical]As I mentioned in the previous post, I put a simple function together to assign the master page for a SharePoint 2013 website using Client Side Object Model (CSOM). This function can be simply used in a provider hosted App or a simple consol application.

Enjoy

// Client Side Object Model
/// <summary>
///
This function gets the site Url and master page name and assigns the new master page to the site
///
</summary>
///
<param name="siteUrl">The URL of the site you'd like to change the master page programmatically</param>
///
<param name="masterPageFileName">The file name of the new master page
///
</param>
protected
void setMasterPageCSOM(string siteUrl, string masterPageFileName)
{
   
ClientContext ctx = new ClientContext(siteUrl);
   
Web rootWeb = ctx.Site.RootWeb;
   
List masterPageList = rootWeb.Lists.GetByTitle("Master Page Gallery");
    Microsoft.SharePoint.Client.
File newMasterPage = masterPageList.RootFolder.Files.GetByUrl(masterPageFileName);
    ctx.Load(newMasterPage, mp => mp.ServerRelativeUrl);
    ctx.ExecuteQuery();
   
Web currentWeb = ctx.Web;
    currentWeb.CustomMasterUrl = newMasterPage.ServerRelativeUrl;
    currentWeb.MasterUrl = newMasterPage.ServerRelativeUrl;
    currentWeb.Update();
    ctx.ExecuteQuery();
    ctx.Dispose();
}

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=378Nov 03, 2015
Assigning master page to a SharePoint 2013 site programmatically (Server Side Object Model) - [Technical]Below is a function with server side code. When I get a chance I put the same functionality together using CSOM.

// Server Side Object Model

protected void setMasterPageSSOM(SPWeb web, string masterPageFileName)

{

    SPFile masterPage;

    if(web.IsRootWeb)

        masterPage = web.Lists["Master Page Gallery"].RootFolder.Files[masterPageFileName];

    else

        masterPage = web.Site.RootWeb.Lists["Master Page Gallery"].RootFolder.Files[masterPageFileName];

    web.CustomMasterUrl = masterPage.ServerRelativeUrl;

    web.MasterUrl = masterPage.ServerRelativeUrl;

    web.Update();

}

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=377Nov 02, 2015
Recreating SharePoint site collection using PowerShell - [Technical]It happens quite often that you need to recreate entire site collection and recreate especially when you are developing Data Model (Lists/Libraries/Site Columns/Content Types), you need to recreate site collection and redeploy from scratch

Probably PowerShell is your best bet.

Below code deletes the site collection at http://sp2013dev/ and recreates another site collection with the root site template of Team Site (template ID: STS#0)

## Configuration information
$siteUrl = "http://sp2013dev/"
$siteOwner = "sp2013dev\someone"

Write-Host Deleting $siteUrl
Remove-SPSite -Identity $siteUrl -Confirm:$False
Write-Host Site collection successfully deleted
Write-Host Creating the team site
$TeamSitetemplate = Get-SPWebTemplate "STS#0"
New-SPSite -Url $siteUrl -OwnerAlias $siteOwner -Template $TeamSitetemplate
Write-Host site recreated
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=376Oct 28, 2015
Value does not fall within the expected range visual studio module (Visual Studio 2012) - [Technical] Anyways, finally the problem was solved by deleting .suo file from the solutions folder. Here is what you do:
1. Close visual studio 2012
2. Open the solution folder in Windows Explorer
3. Find the .suo file (it is a hidden file) and delete it
4. Open the solution again in Visual Studio and keep your everything crossed
Cheers
Alireza ]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=375Jul 09, 2013
How to restore SQL Server 2005/2008 master database - [Technical] ]]>http://www.dotnetking.com/TechnicalComments.aspx?LogID=373Jan 02, 2012Anonymous access for SharePoint 2010 application pages - [Technical]Problem: We would like to create an application page that doesn't require login and any user can open that.

1. Make sure the website that calls the application page is available for anonymous access.
If the URL to the application page is http://server01/_layouts/testpage.aspx, then http://server01/ has to be accessible by anonymous user.

2. When you create an application page in Visual Studio 2010, by default when you open the page in view code, you see the class below:

public partial class testpage : LayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

LayoutsPageBase by default fires the login prompt. So just replace it with equivalent class that can be called in an unsecure context. That class is UnsecuredLayoutsPageBase.

So your code should look like this.

public partial class testpage : UnsecuredLayoutsPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

3. UnsecuredLayoutsPageBase has a read-only property called AllowAnonymousAccess. This property returns false by default which leaves you with an extra step to override it and make it return true. So your final code will look like this:

public partial class testpage : UnsecuredLayoutsPageBase
{
    protected override bool AllowAnonymousAccess
    {
        get
        {
            return true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

Deploy the page and enjoy opening the page without login prompt.

OK, I have done this but it still prompts me for the login info! Well the only other thing that I can think about now is go to the site settings and make sure the master page as a published and approved version.

Note: All the credit of this post goes to Dr. Zewei Song and Kevin Chen. I have just packaged and formatted their work.  

Cheers
Alireza

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=372Dec 14, 2011
Cannot delete content type in SharePoint 2010 - Error: The content type is in use - [Technical]You try to delete a content type in SharePoint 2010 and this is what you see:

Lets review the possible reasons. This error happens when there is a dependency or another object in SharePoint that uses the content type:

  1. A list/library that is already using the content type.
  2. Items in the list/library that use the content type.

OK, we dropped the items that use that content type and we removed the content type from the list/library but still we see the same darn screen when trying to get rid of the content type!
What else can possibly use this content type?
The answer is simple: the same items or libraries that you deleted are still using that content type in RECYCLE BIN. Clean up both recycle bins (user and administrator) and then happily wipe off the ugly content type.

Cheers
Alireza

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=371Sep 10, 2011
SharePoint Trainer website launched! - [Technical] To attend my SharePoint, SQL Server and ASP .NET classes, visit www.sharepointtrainer.ca. ]]>http://www.dotnetking.com/TechnicalComments.aspx?LogID=370Jan 17, 2011BOOTMGR is missing - [Technical] You can find the original post here http://forums.techarena.in/operating-systems/1128154.htm#post4749998

10 step FIX Windows 7 [all versions]

1.) Boot from "WINDOWS 7" DVD;
2.) Select "Repair computer";
3.) Select "Cancel" to exit the repair wizard;
4.) You will now get a screen which displays 'command prompt','system restore','memory diagnostics',etc......
5.) Select "command prompt";
6.) Type your "DVD-DRIVE LETTER" in command prompt, press ENTER;
7.) Now if your Windows 7 is installed in C drive, type "copy bootmgr c:\" without codes, press ENTER;
8.) After successful copy type "exit" without codes, press ENTER;
9.) Reboot computer;
10.) Select "start windows normally";
*****NOW YOU ARE DONE*****

Cheers
Alireza
]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=369Dec 02, 2010
You cannot use SharePoint. Your system administrator has turned off the feature. - [Technical]SharePoint 2007 from Outlook 2010 and I got the error saying “You cannot use SharePoint. Your system administrator has turned off the feature.”
The SharePoint foundation features were enabled on office and the same feature was working like a charm on another machine with the Office 2010. It didn’t take long to find an answer on the net for similar issue with Office 2007 and the same applies to the Office 2010.
By the way SharePoint foundation feature in Office 2010 has nothing to do with this issue. Our server is SharePoint 2007 and at that time SharePoint foundation was not born :D


Solution:
1.On the command-line and run REGEDIT
2.Go to HKEY_CURRENT_USER/Software/Microsoft/Office/14.0/Outlook/Options/wss
3.Double-click on the disable and set the Value data to 0 and click ok.
4.Enjoy the rest of the day.
Special thanks to Jose Baretto.

Cheers
Alireza ]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=368Nov 02, 2010
Visual Studio 2008, ASP .NET and Crystal Report - [Technical] It is interesting that the article "Crystal Reports in ASP .NET Web Applications" is the most viewed page on my website. Although it is not the latest version of Crystal Reports and Visual Studio, the code is still valid with Visual Studio 2008. Now with YouTube and all new video technologies I am thinking of making a video about using Crystal Reports in ASP .NET 3.5 and new components available in the new product.
It is coming soon, Stay tuned.
Cheers
Alireza
 

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=367Feb 12, 2010
How to change the size of Quick Launch menu in SharePoint - [Technical]Assuming that you are using the default master page, the size of the quick launch menu is fixed 150X400 pixels. If the content is anything more than this size it automatically adds scroll bars. To change size of this area open the default.master in SharePoint designer. Go to the code view and find SharePoint:SPRememberScroll tag. The style attribute has the size of the quick launch area.

Here is the default value

Style="overflow: auto;height: 400px;width: 150px; "

 

Simply change it to anything you like:

Style="overflow: auto;height: 400px;width: 250px; "

Cheers
Alireza

]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=366Feb 08, 2010
First Look at SharePoint 2010 – Presented by Savash Alic - [Technical]here.
Cheers
Alireza]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=360Oct 21, 2009
.NET Framework is 7 years old today - [Technical] In 2002 Version 1.0 was released with Visual Studio .NET
In 2003 .NET Framework 1.1 was released embeded in Windows 2003 Server. (Operating system relies on .NET Framework)
In 2005.NET Framework 2.0 was releases with Visual Studio 2005 and SQL Server 2005. (Relational Database engine relies on .NET Framework)
In 2006 .NET Framework 3.0 was released enbeded in Windows Vista and Windows Server 2008. (Client desktop relied on .NET Framework)
In 2007 Microsoft releases .NET Framework 3.5 with Visual Studio 2008 and Windows 7.
Happy Birthday .NET. You are growing fast!
Cheers
Alireza ]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=358Feb 13, 2009
SQL Server 2008, Ideal for developers - [Technical]this article some time back and I really enjoyed it. It reveals the sexiest features of SQL Server 2008 for techies and especially developers. Can anybody show me an articled that explains the value of SQL Server 2008 for executies? In better word I need something that can explain the value of this amazing product for decision makers who are not technical.
Cheers
Alireza ]]>
http://www.dotnetking.com/TechnicalComments.aspx?LogID=357Feb 11, 2009