Other cool features that developers and architects will love are sparse columns, GROUPING SETS, large user-defined data-types (that can exceed the 8000-byte limit), and the new FILESTREAM data type
Thursday, December 27, 2007
A new member of the T-SQL Family - the MERGE statement
One revolutionary addition is the new MERGE statement. On par with other core T-SQL CRUD features such as INSERT, SELECT, UPDATE, and DELETE, the MERGE statement is an ISO-2003 compliant command that is primarily intended to handle what many database users refer to as "UPSERT" functionality. For example, say you have an application where you either need to log a new entry for something that hasn't been added to your system, or update it if it's already been added previously. Without the MERGE statement you must either run a SELECT statement to see if a row has already been logged and then UPDATE or INSERT if it's not there. Or you can try to UPDATE first, and then INSERT if the UPDATE doesn't affect any rows. With the MERGE statement you can do this all in one fell swoop. Here's a rather extensive example of the syntax, pulled from the SQL Server November CTP:
MERGE Production.ProductInventory AS pi
USING (SELECT ProductID, SUM(OrderQty) FROM Sales.SalesOrderDetail sod
JOIN Sales.SalesOrderHeader soh
ON sod.SalesOrderID = soh.SalesOrderID
AND soh.OrderDate = GETDATE()
GROUP BY ProductID) AS src (ProductID, OrderQty)
ON (pi.ProductID = src.ProductID)
WHEN MATCHED AND pi.Quantity - src.OrderQty <> 0
THEN UPDATE SET pi.Quantity = pi.Quantity - src.OrderQty
WHEN MATCHED AND pi.Quantity - src.OrderQty = 0
THEN DELETE;Documentation from a previous CTP's Books Online provides an overview, but the syntax has changed a bit between CTP releases. However, if you study that statement listed above, you can see that it's just a built-in switch (or case) that specifies what to check for, and then what to do if the data is found or not. What's cool about this statement, though, is that you can perform the entire check-in a single operation - which drastically increases performance during large-scale UPSERT operations or when you're trying to merge two large tables.
Table-Valued Parameters
Ever wanted - or more importantly - needed to pass in a table or array of values to your stored procedures? Well, now you can with Table-Valued Parameters. Imagine the following:
CREATE TYPE myTable AS TABLE (
key varchar(6),
value varchar(20)
)
GOCREATE PROC dbo.InsertKeyValuesFromWebApp
@tvp myTable READONLY,
@owner int
AS
SET NOCOUNT ONINSERT INTO [dbo].[SomeTable] (key, value, owner)
SELECT key, value, @owner FROM @tvpRETURN 0
GOFor simpler applications, this functionality might seem like overkill, but for many complex applications, having this code on hand will be a lifesaver. This is something I’ve wanted for years (and which I’ve had to get around by sending in XML fragments as varchar parameters and then re-hydrating on the server) , and now we’ll have native support for it – I can’t wait. I can also see this becoming a wicked bit of functionality when combined with LINQ down the road.
Tuesday, October 30, 2007
SharePoint / MOSS 2007 User Management Explained
Saturday, October 06, 2007
Microsoft Codename "Astoria" CTP toolkit enables developers to create and consume Data Services for the Web
Read More & Download....
Team System Web Access (formerly known as TeamPlain) released
- NEW: Display custom controls on work item forms
- NEW: view queued builds new, queue new builds
- Add new work items or edit existing ones
- Work with any type of work item, including custom ones
- Add new work item queries or edit existing ones
- View, download, upload, check-in and check-out documents on SharePoint team portal
- View reports, export as PDF or Excel
- Browse source control repositories, download files, view changesets, diffs, histories, and annotated views
- View build results, start or stop builds
- Search for keywords in work items
DOWLOAD this awesome tool from Microsoft website today
Thursday, October 04, 2007
SharePoint 2007 / MOSS 2007 Backup Pros and Cons, Evaluation Standards & Strategies (3rd Party tool for MOSS)
AvePoint specializes in award winning, enterprise-strength backup solutions for MOSS 2007, WSS 3.0 and Project Server 2007. Today, with 700+ production customers (many of them Fortune 500 companies) and well over 2000 trial customers across 6 continents, AvePoint has become the dominant market leader in SharePoint staging, backup, and disaster recovery solutions.
Wednesday, October 03, 2007
eMail Management and Outlook Integration through nSynergy (3rd party tool for MOSS)
Why is eMail Management so critical?
eMail management has become a high priority for all businesses, both large and small, with most written correspondence being delivered in email form. Businesses can use tools like SharePoint to manage most of their important business documents, but the inability to easily place emails into SharePoint and share those files within a document library is a problem that many SharePoint users have encountered.
You can now use Outlook to drag and drop emails directly into SharePoint document library folders. You can also view, open, create and access documents and emails directly within Outlook. With emails, documents and other files being accessible through Outlook, everyone in your workplace can use Outlook and SharePoint together to create a powerful yet simple document management tool.
The ability to automatically move emails from Outlook into SharePoint and create document library folders from Outlook is a process that will energize your SharePoint 2007 workflows.
nSynergy product that leverages the familiarity of the Outlook interface and the powerful searching features of SharePoint is needed. Metadata from emails such as Date Received, Date Sent, From and other fields are transferred automatically into a document library’s columns by simply dragging and dropping emails into Outlook folders. This makes it easier to filter and search for these emails and utilize the power of the SharePoint document library views.
Monday, October 01, 2007
How to index PDFs in MOSS 2007 document libraries
The sad fact of the matter is that Windows SharePoint Services (WSS) 3.0 and Microsoft Office SharePoint Server (MOSS) 2007 can't index PDFs by default. That's not news to many veteran SharePoint professionals. Nor is the fact that you can add an icon for PDFs, reindex existing documents, and so forth. However, many administrators are new to SharePoint, and will hit their heads hard against this problem. I was disappointed to see that, despite extensive searching on Google, I could find no single, authoritative, and (most importantly) complete guide for how to do so.
The "bottom line" is that you must install an iFilter for PDFs on your SharePoint servers--specifically, any server that performs search, which would be all WSS servers and your MOSS search server. iFilters are plug-ins that enable indexing of file types. Although iFilter is a Microsoft specification, it is generally through vendors or third parties that you'll get iFilters--not through Microsoft itself.
After you add the iFilter, you must configure SharePoint to index the file type (.PDF). But then, you still have two problems. The biggest is that SharePoint will index only files that are added or existing files whose properties change. So SharePoint will not index existing PDFs when you add the PDF iFilter. You must rebuild your index. The second challenge, purely a cosmetic one, is that you enable SharePoint to display an appropriate icon for PDFs.
This installment will focus on 32-bit WSS servers. Both of these documents contain the word "iFilter" in them, but a search produces only the Word document. Now, let's fix the problem!
1. You will need two downloads: The Adobe PDF iFilter version 6.0, available from Adobe click here
An icon for PDFs, also available from Adobe. Check their licensing page then download the gif
2. Install the iFilter. Note: Many guides on the Internet suggest shutting down Microsoft IIS or the Shared Service Provider (SSP) or the WSS application(s). I found this was not necessary, and Microsoft's own KB article 927675 did not specify it was necessary.
3. Add a registry entry for the .pdf extension in the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Applications\
4. There are two registry keys with specific values that must exist. Verify that these exist and, if not, create them: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf - Value Name: Default; Type: REG_MULTI_SZ; Data: {4C904448-74A9-11D0-AF6E-00C04FD8DC02})
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\Filters\.pdf (Value Name: Default; Type: REG_SZ; Data: (value not set) - Value Name: Extension; Type: REG_SZ; Data: pdf
- Value Name: FileTypeBucket; Type: REG_DWORD; Data: 0x00000001 (1)
- Value Name: MimeTypes; Type: REG_SZ; Data: application/pdf
5. Restart the Windows SharePoint Services Search service. Open a command prompt. Type net stop spsearch, then net start spsearch. Perform a search, and existing PDFs will not be returned. But newly added PDFs will (once indexed by SharePoint) appear in search results. If you modify any property of an existing PDF, it will be indexed. But who wants to modify all existing PDFs in a document library? This is where I found a lot of misinformation online. Even Microsoft's KB 927675 didn't suggest the right solution! It's easy! STSADM, SharePoint's ubercommand, to the rescue!
6. Rebuild the WSS search index.- Open a command prompt.- Navigate to Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN and type the following commands
stsadm.exe -o spsearch -action fullcrawlstop
stsadm.exe -o spsearch -action fullcrawlstart
The existing PDFs will, after being indexed, appear in search results. But they will still not have correct icons. So, while your site is being indexed, keep going with these steps to configure the icon.
7. Open the folder Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images.
8. Copy the gif you downloaded in Step 1 into the folder.
9. Open the folder Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Xml.
10. Right-click the file docicon.xml and choose Open With and select Notepad.
11. In the
12. Save that file and close Notepad.Now, the moment of truth. A search now provides the results.
Microsoft is finally using Microsoft Team Foundation Server internally
Rich Internet application job trends and salaries
How to generate RSA public and private keys as well as export to XML
///
/// Generates 2 XML files (public and private key)
///
/// RSA private key file path
/// RSA private key file path
/// secure size must be above 512
public static void GenerateRsa(string privateKeyPath, string publicKeyPath, int size)
{
//stream to save the keys
FileStream fs = null;
StreamWriter sw = null;
//create RSA provider
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(size);
try
{
//save private key
fs = new FileStream(privateKeyPath, FileMode.Create, FileAccess.Write);
sw = new StreamWriter(fs);
sw.Write(rsa.ToXmlString(true));
sw.Flush();
}
finally
{
if (sw != null) sw.Close();
if (fs != null) fs.Close();
}
try
{
//save public key
fs = new FileStream(publicKeyPath, FileMode.Create, FileAccess.Write);
sw = new StreamWriter(fs);
sw.Write(rsa.ToXmlString(false));
sw.Flush();
}
finally
{
if (sw != null) sw.Close();
if (fs != null) fs.Close();
}
rsa.Clear();
}
Friday, August 24, 2007
Visual Studio Team Foundation Server Web Access Power Tool
Tuesday, August 14, 2007
Tuesday, July 24, 2007
My TOP 10 Coolest Visual Studio 2008 Features
My top ten Visual Studio's IDE features are as follows:
1) Multi-targeting
Visual Studio 2008 is billed as the design surface for the .NET Framework 3.5, which itself is the merger of the .NET 3.0 toolset introduced earlier this year with updated versions of ASP.NET, ADO.NET, Visual Basic, C# and the CLR. At the same time, though, Orcas allows developers to work backwards and develop specifically for .NET 2.0 or 3.0. Once a framework version has been selected, Visual Studio 2008 will enable the reference features that are appropriate for that version of the framework. (In other words, don't try using LINQ in a .NET 2.0 application.)
2) N-tier application development
An n-tier application is spread among any number of different systems, typically a service layer, an access layer and a business logic layer. With such a model, it is easy to share validation logic between entities. Unfortunately, developing such applications in Visual Studio 2005 is pretty much impossible because a dataset and the code that connects it to a database are in the same file. The change in Visual Studio 2008 is subtle but important, as the table and the dataset now reside in different layers.
3) An improved designer
Visual Studio 2005 designer is a little more of the Internet Explorer renderer turned into an editor. To improve upon this, the Visual Studio group turned to Expression, the Microsoft product suite for Web designers. The new designer allows developers to apply styles in line, with an existing class, with a new class or with Internet Explorer. In addition, changes such as margins and paddings around images can be applied to rules and not just individually. This also makes for cleaner CSS files.Finally, the designer offers a split view, so developers can look at source code and design simultaneously. This is a response to the growing trend of development using two monitors.
4) ASP.NET AJAX and VSTO for Office 2007
Right now, developers aiming to build cutting edge Web applications have to download the ASP.NET AJAX framework, and those who want to develop for Office 2007 have to download Visual Studio 2005 Tools for Office Second Edition. Both ASP.NET AJAX and VSTO 2005 SE will be directly incorporated into Visual Studio 2008. VSTO will come with a new runtime, which will run both Office 2007 and Office 2003 add-ins, while ASP.NET AJAX will come with a variety of JavaScript tools, such as IntelliSense and robust debugging.
5) The ADO.NET Entity Framework
The biggest changes to ADO.NET revolve around its Entity Framework, which, unfortunately, is now slated to be released quite a while after Visual Studio 2008. This framework consists of a conceptual layer, which fits between an application's logical database layer and its object layer, and the Entity Data Model. Run the Entity Data Model Wizard in Visual Studio 2008 and the output is three files - a conceptual model that talks to object classes, a logical model that the relational database talks to, and map between the conceptual and logical models. Within the conceptual layer, one finds entity types bundled into sets, associations that define the relationship between entities, and sets of associations. The information in this layer will handle the back and forth with SQL Server without touching data access code. Once entities have been created, developers can use the either CreateQuery or new LINQ to Entities query to retrieve entity objects, data records or anonymous types.
6) LINQ: The Language Integrated Query
In Visual Studio 2005, querying a dataset typically involves a stored procedure, a newly created view and a bit of ADO.NET filtering. This is the case because data exists in rows, while .NET code deals with objects. They are always two different worlds and LINQ puts queries inside the languages and merges the worlds together.
At its most basic level, the Language Integrated Query, a feature of both Visual Basic and C#, uses the concept of the SQL Select statement to make its queries. However, there are two important differences:
(a) Firstly LINQ statements begin with a From statement instead of the Select statement. By listing the data source first, IntelliSense is triggered.
(b) Secondly, since C# is an object-oriented languages, whatever you can express in C# you can make part of LINQ queries. This encompasses anything that is IEnumerable - entities, collections and even XML. Moreover, since the queries are being made in an object-oriented environment, you can do very complex things that result in a completely different result set, such as calling up an instance of objects that did not exist in the source at all.
LINQ also brings about the introduction of several new language concepts for Visual Basic and C#. The expression tree, for example, is a data representation of the LINQ expression that bridges the gap between the .NET code and the SQL Server. In addition, property initialization makes it possible to create an object and set its properties in a single line of code.
Other new language concepts, which will be discussed below, include implicit types and extension methods.
7) Implicit types
Implicit types provide strong typing without forcing developers to figure out the type they need. The compiler does the work for them, since the type is inferred from the initializer expression. Implicit types work well when looping through a collection, since in such a scenario a developer is likely to be looking only for a key and a value and will not know, or care, what is the index type. In addition, inferring types makes it possible for extensions to bind to data types such as XML. This is fundamental to making LINQ work.
8) Extension Methods
Extension methods is a feature coming straight from LINQ, since all LINQ query operators are extension methods. These methods are marked with custom attributes and are then added to other objects automatically (so long as they are not already there). Extension methods can be used just about anywhere a developer would use a normal function. However, they cannot contain optional parameters, parameter arrays or generic arguments that have not been typed. Also, late binding cannot be done with extension methods.
9) IntelliSense
IntelliSense, already referred to as "Intellicrack" in some development circles, is set to encompass keywords, member variables and anything in scope. Moreover, IntelliSense will work with implicit types, once the compiler has figured out what is the type. In addition, LINQ is set up to take advantage of IntelliSense. In SQL syntax, the Select query comes first, but in LINQ, the From statement comes first. With the data source listed first, IntelliSense has a chance to kick in. Visual Studio 2008 has also added JavaScript IntelliSense to accommodate ASP.NET AJAX development.
10) Relaxed delegates, initializers and more
Check this MSDN article to learn more on relaxed delegates and initializers. The emphasis there is on productivity gains developers can expect to enjoy when building data-oriented applications with an increasingly dynamic language.
What is .NET 3.0?
.NET 3.0 consists of four news tools. The Windows Communication Foundation lets developers build unified Web services and other distributed systems that can talk to each other. The Windows Presentation Foundation is a development tool for Web applications and rich client applications. The Windows Workflow Foundation is a programming model for building workflow-enabled applications in Windows. Finally, Windows CardSpace is an identity management component.
In addition to those four new tools, .NET 3.0 also includes several key existing pieces of .NET 2.0, such as ADO.NET 2.0, ASP.NET 2.0, Windows Forms 2.0 and the Common Language Runtime, or CLR 2.0. Microsoft's Expression suite, Windows File System and Visual Studio 2005 development suite are also compatible with .NET 3.0.
Wednesday, July 18, 2007
My TOP 18 Coolest Visual Studio Add-Ons
2) Application Verifier - http://www.microsoft.com/downloads/details.aspx?FamilyID=d2dd7ee0-aaa2-402a-821d-43795d6cf139&DisplayLang=en "Application Verifier is a runtime verification tool for unmanaged code that assists in finding subtle programming errors that can be difficult to identify with normal application testing. Run the Application Verifier tests on your code to identify issues within heaps, handles, and locks."
3) ILMerge - http://www.microsoft.com/downloads/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0&DisplayLang=en "ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output."
4) XML Notepad 2007 - http://www.microsoft.com/downloads/details.aspx?FamilyID=72d6aa49-787d-4118-ba5f-4f30fe913628&DisplayLang=en "XML Notepad 2007 provides a simple intuitive user interface for browsing and editing XML documents."
5) Internet Explorer Developer Toolbar - http://www.microsoft.com/downloads/details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038&DisplayLang=en "The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages."
6) Team Foundation Power Tool - http://www.microsoft.com/downloads/details.aspx?FamilyID=7324c3db-658d-441b-8522-689c557d0a79&DisplayLang=en "The Microsoft Visual Studio 2005 Team Foundation Server Power Tool (formerly known as Power Toys) is a set of enhancements, tools and command line utilities that improve the Team Foundation Server experience."
7) ASP.NET AJAX 1.0 - http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&DisplayLang=en "ASP.NET AJAX is a set of technologies to add AJAX (Asynchronous JavaScript And XML) support to ASP.NET. It consists of a client-side script framework, server controls, and more."
8) Enterprise Library 3.0 - http://www.microsoft.com/downloads/details.aspx?FamilyID=62ef5f79-daf2-43af-9897-d926f03b9e60&DisplayLang=en "This release of Enterprise Library includes: Caching Application Block, Cryptography Application Block, Data Access Application Block, Exception Handling Application Block, Logging Application Block, Policy Injection Application Block, Security Application Block and Validation Application Block."
9) Windows PowerShell 1.0 - http://www.microsoft.com/downloads/details.aspx?FamilyID=6ccb7e0d-8f1d-4b97-a397-47bcc8ba3806&DisplayLang=en "Microsoft Windows PowerShell is a new command-line shell and scripting language designed for system administration and automation. Built on the .NET Framework, Windows PowerShell enables IT professionals and developers control and automate the administration of Windows and applications."
10) Microsoft ASP.NET Futures - http://www.microsoft.com/downloads/details.aspx?FamilyID=9323777e-fe78-430c-ad92-d5be5b5ead98&DisplayLang=en "The Microsoft ASP.NET Futures May 2007 release contains an early developer preview of features providing a wide range of new functionality for both ASP.NET and Silverlight."
11) Reflector for .NET - http://www.aisto.com/roeder/dotnet/ "Reflector is the class browser, explorer, analyzer and documentation viewer for .NET. Reflector allows to easily view, navigate, search, decompile and analyze .NET assemblies in C#, Visual Basic and IL."
12) GhostDoc - http://www.roland-weigelt.de/ghostdoc/ "GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments for C#. Either by using existing documentation inherited from base classes or implemented interfaces, or by deducing comments from name and type of e.g. methods, properties or parameters."
13) DPack - http://www.usysware.com/dpack/ "DPack is designed to greatly increase developer's productivity, automate repetitive processes and expand upon some of the Microsoft Visual Studio features. DPack includes various browser tools that allow the developer to quickly narrow the search down to a particular class, method or assembly type. DPack includes greatly enhanced numbered bookmarks feature, various code navigation tools as well as streamlined surround with feature, and much more."
14) CodeKeep - http://www.codekeep.net/addins.aspx "With the CodeKeep add-in, you can manage your code snippets and search for other code snippets without ever having to leave Visual Studio."
15) AnkhSVN - http://ankhsvn.tigris.org/ "AnkhSVN is an open-source Visual Studio .NET addin for the Subversion version control system. It allows you to perform the most common version control operations directly from inside the VS.NET IDE. Not all the functionality provided by SVN is (yet) supported, but the majority of operations that support the daily workflow are implemented."
16) VSCmdShell - http://visualstudiohacks.com/vscmdshell "The VSCmdShell powertoy combines the command window and the command prompt and makes them available in a single window. Just about anything you can do in the command prompt you can now do right inside of the IDE. You can also execute Visual Studio commands in the same window by simply prefacing that command with an exclamation point, you will even get IntelliSense for the command list. "
17) Regionerate - http://www.rauchy.net/regionerate/ "Regionerate is an open-source tool for developers and team leaders that allows you to automatically apply layout rules on C# code. Regionerate runs on Visual Studio 2005, Visual Studio Codename Orcas Beta 1, #develop 2.0, NAnt and on command line."
18) Consolas Font Pack for VS 2005 - http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en "The Microsoft Consolas Font Family is a set of highly legible fonts designed for ClearType. It is intended for use in programming environments and other circumstances where a monospaced font is specified. This installation package will set the default font for Visual Studio to Consolas."
Tuesday, July 17, 2007
Can i manage Digital Assets (like media, artworks, logos etc) using MOSS 2007?
Friday, July 13, 2007
Banned Function Calls in C++ Programming
Sunday, July 01, 2007
Enterprise Single Sign On with MOSS 2007
Wednesday, June 20, 2007
Microsoft releases Acropolis for .NET Developers
Acropolis is part of the '.NET Client Futures' wave of releases, Microsoft's preview of upcoming technologies for Windows client development. With Acropolis, developers can create a set of modules and build them into a business application. These modules can be hosted within the Microsoft Office 2007 suite or as stand-alone applications. Built-in themes are available, but customization using XAML is also possible.
The product caters primarily to Windows Presentation Foundation development. Check this awesome blog on some common Acropolis questions. Acropolis CTP seems like a very finished product even in this preview. It integrates nicely into the Visual Studio "Orcas" preview. There are some really cool controls to explore in the toolbox. These controls include single and multipart navigation managers, components for providing, updating and publishing data, and several UI controls.
Agile Development Methodologies
No one shoe fits all. Any methodology that requires you to follow it in totality and not let you adapt is rather dogmatic, not pragmatic. To be effective we have to take the best of different approaches and apply to our projects based on our specific needs.
Click here to listen to an awesome Podcast on Agile Development methodologies
Sliverlight Learning Guide
Five Windows Vista security tips .NET developers should know
Tuesday, June 19, 2007
I've linked a SharePoint list to Microsoft Office Outlook 2007 but I don't see any updates when I view the list in Outlook
Saturday, May 19, 2007
SQL Server “Katmai” to Ship in 2008
Monday, May 14, 2007
CAML query Builder
Microsoft APAC SharePoint Conference May 14th - 16th 2007
Friday, May 04, 2007
Denying access to logged in users (website using forms authentication) to the "_layouts" folder for MOSS websites
Tuesday, May 01, 2007
I want to eliminate duplicate documents by creating a link in one document library to a document that exists in another document library. How?
When you select Link to a Document, you're presented with the appropriate fields to enter the document name and location (URL). After you create a link to another document, the document name will be displayed in your document library and identified with the link icon. You can now access the linked document from this document library.
Sunday, April 29, 2007
I've been asked to display the currently logged-on user on the home page of our SharePoint Portal. How can I do this?
Surprisingly, this functionality wasn't a standard UI element in Windows SharePoint Services 2.0 or Microsoft SharePoint Portal Server 2003. Rest assured that Microsoft has added it Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007, but if you're still running the earlier versions, there are a couple of methods you can use to gain this functionality. Probably the easiest approach is to find a third-party Web Part that will display this information. You can download one such free Web Part from the Microsoft SharePoint Products and Technologies Web Component Directory at http://www.microsoft.com/sharepoint/downloads/components/detail.asp?a1=841.
Another approach, which is described on the MSDN FrontPoint blog in the post "Howto: Display the Username for the Logged on user on a page,", uses the Data View Web Part and a few custom Collaborative Application Markup Language (CAML) techniques. Take a look at the article before you decide on the approach you want to take
Thursday, April 26, 2007
A link to my fellow Blogger
Tuesday, April 24, 2007
Updating SPListItem fields in the ItemAdded event or ItemUpdated event does not actually update the ListItem being updated
public override void ItemUpdated(SPItemEventProperties properties)
{
SPListItem curListItem = properties.ListItem;
curListItem["Title"] = "Test";
curListItem.DisableEventFiring(); // Disables event firing temporarily before performing update
curListItem.Update(); // This line should update the ListItem but it doesnt
curListItem.EnableEventFiring(); // Enables event firing once update is complete
}
For the update to go through, its mandatory to set "AllowUnsafeUpdates" property of the Web object with the SPListItem class to true. So the correct version of the above code is as follows:
public override void ItemUpdated(SPItemEventProperties properties)
{
SPListItem curListItem = properties.ListItem;
curListItem.Web.AllowUnsafeUpdates = true; // This property should be set to true for the update to go through
curListItem["Title"] = "Test";
curListItem.DisableEventFiring(); // Disables event firing temporarily before performing update
curListItem.Update(); // This line should update the ListItem but it doesnt
curListItem.EnableEventFiring(); // Enables event firing once update is complete
}
How to stop SpListItem.Update() method from recursively calling the ItemUpdated() event handler
public override void ItemUpdated(SPItemEventProperties properties)
{
SPListItem curListItem = properties.ListItem;
curListItem["Title"] = "Test";
curListItem.Update(); // This line triggers the event to fire again recursively
}
A possible solution is to use the Enable/Disable Event Firing methods available on the SPListItem object. For example:
public override void ItemUpdated(SPItemEventProperties properties)
{
SPListItem curListItem = properties.ListItem;
curListItem["Title"] = "Test";
curListItem.DisableEventFiring(); // Disables event firing temporarily before performing update
curListItem.Update(); // This line triggers the event to fire again recursively
curListItem.EnableEventFiring(); // Enables event firing once update is complete
}
Monday, April 23, 2007
Common Search Crawler GOTCHAS - Crawler complains "Access Denied" as WSS site has form authentication enabled
Error
- http://ragavtestsearch.com.au (Link does not work and is used for illustration purpose only)
- Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (The item was deleted because it was either not found or the crawler was denied access to it.)
Therefore, you will need a new web application with the same site content as the form-auth site and with the NTLM authentication enabled. How can you do it? You can use the SharePoint feature, "Extend an existing web application". Please follow the steps as below to extend a web application.
Extend the web application
- Extend the form-authenticiation web application to a zone with windows-integrated authentication (NTLM) enabled
- Go to Central Administration > Application Management page
- Click Create or Extend web application and select Extend an existing web application
- Make sure if the web application field shows the one you have set up the form authentication. If not, click on the drop down menu and select the web application in a popup dialog, e.g. SharePoint - 80
- Either choose to use the randomly-generated port or assign a port. (The extended web application will be located at this port and share the same content as the original web application)
- Select NTLM
- Select No for Allow Anonymous option
- Choose a zone (e.g. custom)
- Click OK
- After the web app is extended, the page will be redirected to the central administration page.
- To test the site, please access to the extended web application and log on to the site with your search crawl acount.
Grant Permission
Please make sure if the search crawl account has access to the new web application. If not, please follow these steps to grant permission
- Go to Central Administration > Application Management page
- Click on Policy for web application
- Click on Add Users
- Make sure if the web application field shows the one you have set up the form authentication.
- Select the zone that you extended the web application (e.g. custom)
- Click Next
- Enter the crawl account username to Users field
- Check Full Read for the permission
- Click Finish
- To test the site, please access to the extended web application and log on to the site with your search crawl acount.
In the next crawl, the crawler will access to the site content through this “secret” NTLM web application. It will be able to get the form authentication descriptor of the content. After the crawl’s completed, you will see search results in your form-authentication site. It’s important to know that the URL of search hit will be based on your form-authentication site, because it’s depending on where you are searching from.
(Thanks to the great tips offered by wsssearch website. You can find more information about this website here)
Saturday, April 21, 2007
Reach me on LinkedIn Network
Using ASP.Net user controls in your WSSV3/MOSS ASPX pages
Following on from Chris Johnson's post of application dev on SharePoint (here), I have had some people ask how to embed ASP.Net User Controls in the pages you can add to your site using Option 4 (see post for more details on what this option is).
Well ... i did some digging/research and have this set of steps to achieve this. Here goes:
1. Create a Directory called "usercontrols" in the root of your sharepoint web site on the file system E.g. C:\Inetpub\wwwroot\wss\VirtualDirectories\moss.litwareinc.com80\UserControls
2. Open IIS manager and in the root of your SharePoint site create a VirtualDirectory called "_controls" and point it to that newly created directory.
3. Put your user control in that newly created directory on the filesystem
4. Open the web.config file and add the following:
5. In your ASPX page add the following:
<%@ Register src="~/_controls/SomeControl.ascx" mce_src="~/_controls/SomeControl.ascx" TagName="somecontrol" TagPrefix="uc2" %>
And...
6. Run your ASPX page and your control should render correctly.
Toggle of Anonymous access fixed for MOSS 2007 sites
What I did :
Make sure the viewformpageslockdown feature is enabled on the site
Navigate to the top level site collection’s root web Site Settings
Click the Advanced permissions link under the Users and Permissions section
Now under the settings menu, select anonymous access
Set Anonymous users can access to Nothing
Then step through the process again and re-enable anonymous access by setting anonymous access to Entire Web site.
And it works !!!
So now http://www.ragavtest.com/Pages/forms/allitems.aspx (for illustration only as link is not active) returns a 401 UNAUTHORIZED and the website is now secured as it should be.
And all it required was a toggle of anonymous access for the viewformpageslockdown feature to kick-in.
Custom help window can be opened by hacking into the Core.js file in MOSS 2007
function HelpWindowHelper(strParam)
{
var strHelpUrl;
if (typeof(strParam)=="undefined")
{strHelpUrl="/_layouts/help.aspx?Lcid="+L_Language_Text;}
else if (strParam == "&Key=Custom") /* Present new Custom Help Windows when parameter is 'Custom' */
{strHelpUrl="/pages/CustomHelp.aspx?Lcid="+L_Language_Text+strParam;}
else
{strHelpUrl="/_layouts/help.aspx?Lcid="+L_Language_Text+strParam;}
var wndHelp=window.open(strHelpUrl, "STSHELP",
"height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=475"
);
wndHelp.focus();
}
Please note that this change should be tracked and documented as its a unsupported hack for future Service Pack releases of MOSS 2007 (as SPs might overwrite "Core.js" with its own new version, in which case you will loose your changes if you havent documented them)
How to register your custom events in MOSS 2007
1) Ensure that the assembly implementing the custom event handlers in strongly typed (i.e., should be signed with your private key - Click here to learn how to do this...)
2) Ensure that your custom event handlers strongly typed assembly has been registered in the GAC of the server (or on each server on a web farm).
Once you have checked the pre-requisites you can write a Console application to do your job. An example is as below:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace RagavWebsite.Website.RegisterEventHandlers
{
// Console application to register custom event handlers on a specific list called "Comments" on the website
class Program
{
static void Main(string[] args)
{
SPSite curSite = new SPSite("http://RagavWebsite/sites/Vowel/RagavBlog");
SPWeb curWeb = curSite.OpenWeb();
SPList commentsList = curWeb.Lists["Comments"];
string asmName = "RagavWebsite.WebSite.EventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=682fb345e6f432a";
string className = "RagavWebsite.WebSite.EventHandler.RagavWebsiteVowelCheckItemHandler";
commentsList.EventReceivers.Add(SPEventReceiverType.ItemAdding, asmName, className);
commentsList.EventReceivers.Add(SPEventReceiverType.ItemUpdating, asmName, className);
}
}
}
ItemAdded event handler vs. ItemAdding event handler
Also note that in your event handler code, you would need to use the "AfterProperties" bag to read the list field values that have changed (as opposed to the "Properties" bag). For example:
private void VowelCheck(SPItemEventProperties properties)
{
string vowelErrorMessage = string.Empty;
// Check whether the Title field exists within the List
if (properties.AfterProperties["Title"] != null)
{
// Assumption that you have a class called VowelListManager.cs which has a function CheckVowelExists()
vowelErrorMessage = VowelListManager.CheckVowelExists(properties.AfterProperties["Title"].ToString());
}
// If Error Message is returned then the current words has failed the vowel test- This code also shows how to cancel a SharePoint event (like stop the item from being added or updated)
if (!vowelErrorMessage.Equals(string.Empty))
{
properties.ErrorMessage = vowelErrorMessage;
properties.Cancel = true;
}
}
SharePoint Tips and Tricks
1) Masking the user’s email and other details.
2) The restrictive read access for lists that would prevent anonymous users to see the all items page but it will allow a webpart running in anonymous context to read the list items.
A possible solution for this is as follows:
1) User email details – disable the page – add a webpart or a handler that redirects the req. (this is my understanding of the only way this can be done)
2) Restrictive read – make sure you used the publishing template and make sure this is active:
Use lockdown mode:
Lockdown mode is a feature that you can use to secure published sites. When lockdown mode is turned on, fine-grain permissions for the limited access permission level are reduced. The following table details the default permissions of the limited access permission level and the reduced permissions when lockdown mode is turned on - Read more here...