12/23/2009

SharePoint: The security validation for this page is invalid

 

Note: The following applies to both SharePoint 2007 and 2010.


When creating an ASPX page in the LAYOUTS folder that updates SharePoint content via the API (mylistitem.upate) you may get the following message when posting back to the page:

 

2007:
image

2010:
image

Many articles on the web suggest using AllowUnsafeUpdates:

SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;


While this works, it does open the page up to cross-site scripting vulnerabilities. (See here: MSDN)

A better practice is to add a FormDigest control to your page. (See details here: MSDN)  If you are not using a master page or a complete “SharePoint page” then you will also need to add a Register line to reference Microsoft.SharePoint.WebControls.

The reference:

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

The control:

  <SharePoint:FormDigest runat=server/>

A sample page:

 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<SharePoint:FormDigest runat=server/>
<div>
<asp:TextBox ID="txtSomeText" runat="server" />
<asp:Button ID="btnReplace" runat="server" Text="Replace" OnClick="btnDoSomeWork_Click" />
</div>
</form>
</body>
</html>






.

12/21/2009

SharePoint: Worst SharePoint Error Message?

(MOSS 2007)

“WSS_Search_servername on servername contains user-defined schema. Databases must be empty before they can be used. Delete all of the tables, stored procedures and other objects or use a different database.”

 

Just got this on one of my virtual machines:

image

 

I just love this part: “Delete all of the tables, stored procedures and other objects or use a different database.” That’s kind of like responding to “I can’t connect to the internet” with “format drive C: and start over”.

Either the developer was having a bad day or has a real attitude!

 

Is this important?   Not really!   WSS Search is only used in MOSS to index the SharePoint help files, and this only needs to be done once (at least until the next service pack potentially updates the search content).  And, have you ever found this help content to be very helpful?

So for now… help works, but is just not searchable. You can still navigation the table of contents. (But I do have a fix at the end of this article…)

 

No results: But should look like this:
image image

                                                           

 

How I got the error:

This message was displayed in Central Administration when I tried to start the search services. I’m not sure why they were stopped. I may have stopped them to improve performance on the VPC or they may have just stopped.

image

 

 

A similar error was logged in the Windows Event log:

image

 

 

 

The fix?

Go to Central Administration to the services on server list and click start for the WSS Search. Enter a new database name!  I just appended a “B” to the end of the existing name.  (You can now go to your SQL admin tools and delete the old database if you like.)  I also had to do an IISRESET, but could have probably waited and it would have reindexed.

And… after you get it working and the content has been index, stop it!  Or at least set the schedule so it only indexes once a night. The Help content NEVER CHANGES!

image

12/07/2009

SharePoint 2010: Change the passphrase

 

When you install SharePoint using an option other than Stand-Alone you will be asked for a “Passphrase” that can be used later on for things like adding a new server to the farm. This is especially needed if you let SharePoint 2010 manage your service account passwords where SharePoint will automatically change the passwords to strong, but unknown passwords.

I don’t think there is anyway to retrieve the passphrase if you forget it. If you need to change the passphrase after the install you can use PowerShell. (Don’t know PowerShell yet? You will…) 

  • From your Start menu select “SharePoint 2010 Management Shell” or Start, “Microsoft SharePoint 2010 Products”, “SharePoint 2010 Management Shell”
  • Then enter:

      C:\PS> $passphrase = ConvertTo-SecureString -asPlainText -Force
      C:\PS> Set-SPPassPhrase -PassPhrase $passphrase -Confirm

The first line will prompt you for a password and store the secure version in the $passphrase variable.
The second line will prompt you to confirm the passphrase and then ask you if you are REALLY sure you want to do this.

 

image

 

I have not seen anything in TechNet on this command yet. For help on this command from PowerShell type:

    help passphrase

      or

    help passphrase  -examples

image

12/06/2009

Silverlight: Useful links

Below are some of the resources I refer to in my Silverlight classes.

These include:

  • Official Sites
  • Tutorial Sites
  • Best places to ask questions (forums)
  • What’s new in Silverlight 3
  • What’s new in Silverlight 4
  • Downloads
  • Other useful links

 

Official Sites:

 

They both claim to be “the official site”!

Sites for Expression Blend:

MSDN Library for Silverlight

 

Tutorial Sites:

 

 

Best places to ask questions:


MSDN forums:

Silverlight.net Forums:
(As of 12/5/09: 178,572 threads and 222,975 posts, contributed by 67,146 members from around the world!)

  • http://forums.silverlight.net/default.aspx
    • Installation and Setup
    • Getting Started
    • Hosting and Streaming
    • New Features in Silverlight 3
    • Silverlight 4 Beta
    • Designing with Silverlight
    • Video and Media
    • Expression Studio
    • Programming with JavaScript
    • Programming with .NET – General
    • Silverlight Controls and Silverlight Toolkit
    • Visual Studio & Silverlight Development Tools
    • Report a Silverlight Bug
    • Accessing Web Services with Silverlight
    • Game Development
    • WCF RIA Services

 

What’s new in Silverlight 3:

 

What’s new in Silverlight 4:

 

Downloads:

Other useful links…

 

What percent of users actually have Silverlight installed?

Datasets and Data Tables with Silverlight:

As a .Net developer we know DataSets and DataTables, and we often deliver these via web services, but Silverlight does not directly support Datasets or Datatables. There are a few workarounds using LINQ, custom libraries and even a custom grid control…

Pushing data to Silverlight from a server

Dealing with Cross-Domain issues

About loading images (and URLs)

Silverlight to JavaScript, JavaScript to Silverlight:

 Silverlight and SharePoint

12/03/2009

SharePoint 2010: Office Web Apps – The “in browser” Office

One of the cool features demo’ed with SharePoint 2010 are the “in browser” Office Web Apps. These are browser based versions of Word, Excel, PowerPoint and OneNote. But…  you won’t find these when you download and install Beta 2. They are a separate download and install.

Cool stuff:

  • Create, View and Edit Excel, Word and PowerPoint documents (BUT only Office 2007 and 2010 documents – docx, pptx, xlsx)
  • View and edit Word documents
  • Co-author Excel files (really! two people editing the same file at the same time and see each other’s changes as they are made!)
  • View PowerPoints, with transitions, fades, etc!  In the browser or as a full screen slide show.

Things to download and notes:

  • The instructions: Deploy Office Web Apps
  • The license key is in the above document!
  • The install file: WcServer_?????.exe  (you can download one of seven language versions)  (WcServer_en-us.exe for English)
  • Run the install
  • If you installed SharePoint as a “Standalone install” (Basic install) then do not follow the instructions in the above word document to enable the services, they were already running. All I needed to do was to go to the site collection and enable the “Office Word Apps” feature. All done… that’s all…

Other notes:

  • So far I have not seen how to create a new document using these features. The New button in the library still launches the desk top application.

Excel Web App in View mode:

  image

In Edit mode:

  image

11/30/2009

SharePoint 2010: SharePoint Server Databases

 

 

The following is a list of databases installed in a “Basic” install of SharePoint Server 2010.

 

Notes:

  • SQL Server Express 2008 Service Pack 1 was installed

       Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)
           Mar 29 2009 10:11:52
           Copyright (c) 1988-2008 Microsoft Corporation
           Express Edition (64-bit) on
            Windows NT 6.1 <X64> (Build 7600: ) (VM)

  • If you want to install the SQL Express Management Tools:
    • remember to download the 64 bit version
    • check out this article or you won’t guess the correct choice (New Installation, not Add new features) http://www.asql.biz/Articoli/SQLX08/Art3_1.aspx
    • the SQL Profiler is not part of the Express tools
  • A new instance was created named SHAREPOINT  (yourservername.SHAREPOINT). The instance was created in
    C:\Program Files\Microsoft SQL Server\MSSQL10.SHAREPOINT
  • The databases were created in:
    C:\Program Files\Microsoft Office Servers\14.0\Data\MSSQL10.SHAREPOINT\MSSQL\DATA
    (Foundation defaults to here: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Data\MSSQL10.SHAREPOINT\MSSQL\DATA)

Database Names:

  • The “system” databases are named with GUIDs. We used to avoid this, or rename these, but it’s probably best to now leave these alone.
  • In SharePoint Foundation 2010 these include:
    • Bdc_Service_DB_guid   -  Business Connectivity Services (BCS)  (the old BDC)
    • SharePoint_AdminContent_guid  - Central Administration
    • SharePoint_Config_guid – the SharePoint Configuration database
  • In SharePoint Server 2010 they add:
    • Application_Registry_Service_DB_guid
    • Managed Metadata Service_guid
    • PerformancePoint Service Application_guid
    • Search_Service_Application_CrawlStoreDB_guid
    • Search_Service_Application_DB_guid
    • Search_Service_Application_PropertyStoreDB_guid
    • Secure_Store_Service_DB_guid
    • StateService_guid
    • User Profile Service Application_ProfileDB_guid
    • User Profile Service Application_SocialDB_guid
    • User Profile Service Application_SyncDB_guid
    • WebAnalyticsServiceApplication_ReportingDB_guid
    • WebAnalyticsServiceApplication_StagingDB_guid
    • Word Automation Services_guid
  • The content databases follow the 2007 pattern: WSS_Content or what ever you enter when you create a new application. (and I thought the “WSS” name was gone!)
  • WSS_Search_yourservername – The WSS search database
  • The new logging database! WSS_Logging. Think of this one as the one SharePoint database you are supposed to do direct TSQL queries from! As a teaser… here’s a list of the views (I’d show the tables, but each has 32 partitions): 
                                                   image

Files from my install (your GUIDs will vary)

    image

  Databases and log files in SharePoint Foundation 2010:

  • Bdc_Service_DB_778ccd3e047d45c1b71529c004ebbd2c.mdf
    Bdc_Service_DB_778ccd3e047d45c1b71529c004ebbd2c_log.LDF
  • SharePoint_AdminContent_4ab2813a-fe77-4085-86df-41d3a79df116.mdf
    SharePoint_AdminContent_4ab2813a-fe77-4085-86df-41d3a79df116_log.LDF
  • SharePoint_Config_e5403261-4d7a-4b9e-bef2-286c46b588da.mdf
    SharePoint_Config_e5403261-4d7a-4b9e-bef2-286c46b588da_log.LDF
  • WSS_Content.mdf
    WSS_Content_log.LDF
  • WSS_Logging.mdf
    WSS_Logging_log.LDF
  • WSS_Search_MAXSP2010BETA2.mdf
    WSS_Search_MAXSP2010BETA2_log.LDF

   Additional databases and log files in SharePoint Server 2010:

  • Application_Registry_Service_DB_b669b0a586ce4cfaa1020e9e75824843.mdf
    Application_Registry_Service_DB_b669b0a586ce4cfaa1020e9e75824843_log.LDF
  • Managed Metadata Service_6b696a9bda574b29a0bba4009c782316.mdf
    Managed Metadata Service_6b696a9bda574b29a0bba4009c782316_log.LDF
  • PerformancePoint Service Application_106ff2206d784297adbd4ec157aef7b5.mdf
    PerformancePoint Service Application_106ff2206d784297adbd4ec157aef7b5_log.LDF
  • Search_Service_Application_CrawlStoreDB_16d445d62e314cd58c82d75fc304a225.mdf
    Search_Service_Application_CrawlStoreDB_16d445d62e314cd58c82d75fc304a225_log.LDF
  • Search_Service_Application_DB_e172668d1a534fd981b53146014d5ef3.mdf
    Search_Service_Application_DB_e172668d1a534fd981b53146014d5ef3_log.LDF
  • Search_Service_Application_PropertyStoreDB_10c4d562200442748ca6339d4b358c84.mdf
    Search_Service_Application_PropertyStoreDB_10c4d562200442748ca6339d4b358c84_log.LDF
  • Secure_Store_Service_DB_edd7b8e261fa491bb336779301aa5bf9.mdf
    Secure_Store_Service_DB_edd7b8e261fa491bb336779301aa5bf9_log.LDF
  • StateService_335919bb65d1430aa20424a67a99589e.mdf
    StateService_335919bb65d1430aa20424a67a99589e_log.LDF
  • User Profile Service Application_ProfileDB_9e421f2d762c46609a8a15fab15a3d52.mdf
    User Profile Service Application_ProfileDB_9e421f2d762c46609a8a15fab15a3d52_log.LDF
  • User Profile Service Application_SocialDB_81269e32afd049d48994a72362806da4.mdf
    User Profile Service Application_SocialDB_81269e32afd049d48994a72362806da4_log.LDF
  • User Profile Service Application_SyncDB_8c10242fd8064682aa1ac620acfa1733.mdf
    User Profile Service Application_SyncDB_8c10242fd8064682aa1ac620acfa1733_log.LDF
  • WebAnalyticsServiceApplication_ReportingDB_1684bae4-0271-40f0-9e4d-84c6660e99e0.mdf
    WebAnalyticsServiceApplication_ReportingDB_1684bae4-0271-40f0-9e4d-84c6660e99e0_log.LDF
  • WebAnalyticsServiceApplication_StagingDB_13d64d79-9237-492c-ad2d-48785d13a1ff.mdf
    WebAnalyticsServiceApplication_StagingDB_13d64d79-9237-492c-ad2d-48785d13a1ff_log.LDF
  • Word Automation Services_5fd65b951cf1499eaa72997b9668fd04.mdf
    Word Automation Services_5fd65b951cf1499eaa72997b9668fd04_log.LDF

 

  There are also the standard SQL Server databases there:

  • master.mdf
  • mastlog.ldf
  • model.mdf
  • modellog.ldf
  • MSDBData.mdf
  • MSDBLog.ldf
  • tempdb.mdf
  • templog.ldf

   And this file:

  • MS_AgentSigningCertificate.cer

.

SharePoint 2010: Error Messages

 

A few end-user (browser) error messages common in SharePoint 2010 Beta 2…

 

Message from webpage:

 

image

- A datasheet component compatible with Microsoft SharePoint Foundation is not installed.

- Your Web browser does not support ActiveX controls.

- A component is not properly configured for 32-bit or 64-bit support.

 

The error above most often from not having a suitable version of Microsoft Office installed.

This error is often display when trying to use:

  • Multiple file upload
  • Datasheet view

 

This control is currently disabled

Error displayed from the ribbon:

image

 

This error is often display when trying to use:

  • Multiple file upload
  • Outlook sync when Outlook is not installed

Message from webpage – The document could not be created.

The following message is from clicking the New button in a document library when Office is not installed.

image

 

Excel Export

image

No Excel 2007 or 2010 installed.

SharePoint 2010: SharePoint Foundation Databases

 

The following is a list of databases installed in a “Basic” install of SharePoint Foundation 2010.

 

Notes:

  • SQL Server Express 2008 Service Pack 1 was installed
  •    Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)
           Mar 29 2009 10:11:52
           Copyright (c) 1988-2008 Microsoft Corporation
           Express Edition (64-bit) on
            Windows NT 6.1 <X64> (Build 7600: ) (VM)

  • If you want to install the SQL Express Management Tools:
    • remember to download the 64 bit version
    • check out this article or you won’t guess the correct choice (New Installation, not Add new features) http://www.asql.biz/Articoli/SQLX08/Art3_1.aspx
    • the SQL Profiler is not part of the Express tools
  • A new instance was created named SHAREPOINT  (yourservername.SHAREPOINT). The instance was created in
    C:\Program Files\Microsoft SQL Server\MSSQL10.SHAREPOINT
  • The databases were created in:
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Data\MSSQL10.SHAREPOINT\MSSQL\DATA

Database Names:

  • The “system” databases are named with GUIDs. We used to avoid this, or rename these, but it’s probably best to now leave these alone.
    In SharePoint Foundation these include:
    • Bdc_Service_DB_guid   -  Business Connectivity Services (BCS)  (the old BDC)
    • SharePoint_AdminContent_guid  - Central Administration
    • SharePoint_Config_guid – the SharePoint Configuration database
  • The content databases follow the 2007 pattern: WSS_Content or what ever you enter when you create a new application. (and I thought the “WSS” name was gone!)
  • WSS_Search_yourservername – The WSS search database
  • The new logging database! WSS_Logging. Think of this one as the one SharePoint database you are supposed to do direct TSQL queries from! As a teaser… here’s a list of the views (I’d show the tables, but each has 32 partitions):
                                                   image

Files from my install (your GUIDs will vary)

       image

  Databases and log files:

  • Bdc_Service_DB_778ccd3e047d45c1b71529c004ebbd2c.mdf
    Bdc_Service_DB_778ccd3e047d45c1b71529c004ebbd2c_log.LDF
  • SharePoint_AdminContent_4ab2813a-fe77-4085-86df-41d3a79df116.mdf
    SharePoint_AdminContent_4ab2813a-fe77-4085-86df-41d3a79df116_log.LDF
  • SharePoint_Config_e5403261-4d7a-4b9e-bef2-286c46b588da.mdf
    SharePoint_Config_e5403261-4d7a-4b9e-bef2-286c46b588da_log.LDF
  • WSS_Content.mdf
    WSS_Content_log.LDF
  • WSS_Logging.mdf
    WSS_Logging_log.LDF
  • WSS_Search_MAXSP2010BETA2.mdf
    WSS_Search_MAXSP2010BETA2_log.LDF

 

  There are also the standard SQL Server databases there:

  • master.mdf
  • mastlog.ldf
  • model.mdf
  • modellog.ldf
  • MSDBData.mdf
  • MSDBLog.ldf
  • tempdb.mdf
  • templog.ldf

 

  And this file:

  • MS_AgentSigningCertificate.cer

 

 

image

11/29/2009

SharePoint 2010: Select Template Later!

In SharePoint 2003 an administrator could create a new site collection without having to select a template. The link to the new site collection could then be emailed to the new owner and on their first visit to the new URL they could select a template. This option disappeared in 2007. It’s back in 2010! (but with a very interesting difference… see below…)

Note: This only works from Central Administration when creating a new site collection. It is not available when creating sub sites within an existing site.

 

When creating a site in Central Administration:

image

 

When first visiting the new URL:

image

 

What’s Different?

In 2003 you had to select a template before continuing. Now in 2010 you actually have a functioning, but template-less, site. See the Site Actions, View All Site Content and Recycle Bin options? They all work even though a template has not been selected yet.

The new (template-less) site defaults to /_layouts/templatepick.aspx as a home page. There is no default.aspx page or Site Pages library yet.

As a test I went to Central Administration and created a new site collection with this template option. I then went to the site and ignored the request to pick a template and went and changed the site title, the theme, activated the “Team Collaboration Lists” feature and added a Links List for “Vendors”. I then returned to templatepick.aspx page and selected a template. It all seems to work fine.

So now we can:

  • Let the new site owner pick their own template
  • Preload lists and libraries
  • Preselect a theme

Let us know if you find any issues with this…

 

A final note…

If the template can be picked at a later time, can it now be changed?  Sorry, but no. If you return to /_layouts/templatepick.aspx and try to select a different template you will get:

image

 

.

11/27/2009

SharePoint: List and libraries by SharePoint version (2007 & 2010)

Just a quick list… maybe I’ll find some time to add links to resources for each list and library type.

 

image

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.