|
Aug
24
Published: August 24, 2010 14:08 PM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
SharePoint Project Items (SPIs) are new to Visual Studio 2010. Historically, organizing projects into folders containing files with a type affinity for one another was common. For example, developers often organize disparate CSS files into a styles folder; GIFs, JPGs, and PNGs into an images folder; and disparate JavaScript files into a scripts directory. The benefit is that, if another developer had to support someone else's work, he or she would be able to anticipate where assets of a common type would be found. SPIs are effectively folders that hold a motley collection of files with a common purpose, rather than a common type. Each file may have a unique deployment location and a unique purpose, but they are organized into the SPI folder because they work together for a common purpose—typically to create some type of SharePoint platform extension. This would be akin to keeping the CSS, images, and JavaScript in a folder along with the .aspx page that consumes them. The SPI model definitely takes some getting used to, but it isn’t going to change any time soon—if ever. "Embrace and extend" is my motto. The chart below lists all the SPIs along with the ways that they can be created. The first column shows the SPIs that can be created at the same time that a new SharePoint Project is created (along with the four SharePoint Projects that are not also SPIs). The second column shows the SPIs that can be added from the {ProjectRoot} of any SharePoint Project. The third column shows the SPIs that can be added from the context of another SPI; that doesn't imply that they will be created within the SPI folder, just that they are available in that context.
Enjoy! <Todd />
Aug
01
Published: August 01, 2010 14:08 PM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
The latest version of CKSDev includes: - Improved SPMetal SPI
- Improved Full Trust Proxy SPI
- New grouped content types and import function
- New site columns and import function
- New Fluent UI Visual web part SPI
- Improvements to quick deploy
- Under the cover code improvements
- Improved import content type
- Powershell added to the references tab
SharePoint Developer must have! <Todd />
Jul
07
Published: July 07, 2010 07:07 AM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
For years now I've used a simple technique for identifying public facing SharePoint 2003/2007 sites. I type http://[domain]/_layouts/images/CPVW.GIF into my browser which displays the Lorem ipsum image by default when SharePoint is installed: Since most people allow anonymous access to the images in the 60 Hive/12 Hive and there really isn't any reason to remove the default images (in fact it probably isn't supported), it is an easy litmus test to detect SharePoint. However, I recently wanted to determine whether a site was SharePoint 2010 or not, but since visual upgrade is now a viable upgrade scenario and CPVW.GIF is not unique to the SharePoint 2010 I needed something new to look for. So, I poked around a bit and found that /_layouts/images/FGIMG.PNG isn't too hard to remember and it shows an equally unlikely image to be in a non-SharePoint 2010 site: Of course, if people block access to the images in the {SharePointRoot}, the image won't be found. However, SharePoint relies heavily on many of the sub-images in this particular PNG to display many of the out-of-the-box pages. The good news is that while this method isn't very sophisticated, it is super easy ("no assembly required") and it rarely turns up false positives. ; ) Ian Morrish maintains a list of SharePoint Sites you can try it out on. Happy hunting! <Todd />
Jul
02
Published: July 02, 2010 17:07 PM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
The following was written in response to Andreas' post here: http://blog.dynatrace.com/2009/01/11/the-wrong-way-to-iterate-through-sharepoint-splist-items/ However, my comment on his post didn't come thru very well so I’m posting my response here instead. Very rarely use a for index to iterate any collection in SharePoint. The SharePoint API will "do the right thing" (including using cache when appropriate, using good SQL query techniques, and the pre-creation of the next object in anticipation of the likely continued loop) in most circumstances when you use foreach for iteration instead. So, the code above would better be written as follows: SPListItemCollection items = SPContext.Current.List.Items; foreach(SPListItem item in items) { htmlWriter.Write(item["Title"]); } Not only is this more performant but it is easier to read so general supportability will improve too. I'll leave the suspicious SPContext.Current.List and htmlWriter for someone else to take issue with. Also retrieving the entire SPListItemCollection into memory can have it's own set of problems. Consider the situation where there are thousands of list items with dozens of columns. That will produce quite a memory footprint just to write out the title of each SPListItem. I would highly recommend that you consider a CAML query (or LINQ to SharePoint which will generate a CAML query if using SharePoint 2010) and the GetItems method. The following example code will run in a Console App and it reads the SPListItem with a Title of "One" from the Tasks list in a Site Collection found at http://localhost. Even though this includes a sort, it is far more performant than the iteration originally demonstrated in this blog post. using (SPSite siteCollection = new SPSite("http://intranet")) { SPWeb web = siteCollection.RootWeb; SPList list = web.Lists["Tasks"]; if (null != list) { StringBuilder sb = new StringBuilder(); sb.Append("<Where>") .Append(" <Eq>") .Append(" <FieldRef Name='Title' />") .Append(" <Value Type='Text'>One</Value>") .Append(" </Eq>") .Append("</Where>") .Append("<OrderBy>") .Append(" <FieldRef Name='Title' Ascending='TRUE' />") .Append("</OrderBy>"); SPQuery qry = new SPQuery(); qry.ViewFields = "<FieldRef Name='Title' />"; qry.Query = sb.ToString(); qry.ViewFieldsOnly = true; SPListItemCollection items = list.GetItems(qry); foreach (SPListItem item in items) { Console.WriteLine(item["Title"]); } } Console.WriteLine("---Done"); Console.ReadLine(); } For even more robust sample code, see the ViewFields entry in the SDK: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.viewfields.aspx HTH, <Todd />
Mar
18
Published: March 18, 2010 09:03 AM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
My home town. Yeah! : ) Let's talk about the SharePoint 2010 Ribbon... Read the details on the SharePoint Saturday site. <Todd />
Jan
26
Published: January 26, 2010 19:01 PM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
This rocks! Microsoft has released a SharePoint 2010 Beta 2 evaluation VHD complete with everything including Visual Studio 2010 and Office 2010 installed and ready to go. Download this excellent developer resource here: http://www.microsoft.com/downloads/details.aspx?FamilyID=0c51819b-3d40-435c-a103-a5481fe0a0d2 However, the post says that you'll need 50GB to install the two Hyper-V VMs. 50GB, Yikes! That said, my developer VM running Windows 7, SPF 2010 only, non-domain, non-standalone on top of a full SQL Server 2008 install is nearly 30GB. Thank God for large external 2.5" drives. <Todd />
Jan
17
Published: January 17, 2010 19:01 PM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
![CKS_logo[2] CKS_logo[2]](/Todd/Lists/Posts/Attachments/24/CKS_logo2_thumb_39C2418F.gif) Announcing CKS:DEV at http://cksdev.CodePlex.com As you may know, Visual Studio 2010 has enhanced our ability to extend its functionality. Several SharePoint developer productivity extension projects have been merged into a single uber SharePoint Development Tools Edition of the Community Kit for SharePoint. This excellent work is the collective effort of the following brilliant guys: While we have more ideas in the works, this initial release is already huge. It includes the following productivity aids (and more) categorized as follows... Environment - SharePoint References - Adds a SharePoint tab to the Add Reference dialog.
- Copy Assembly Name - Copies the assembly name of a SharePoint project onto the clipboard.
- Sandbox Compile - Compiles the project against the SharePoint subset object model to ensure the code only uses subset OM features.
Exploration - View Feature Dependencies - Adds subnodes to the Feature node to drill down into feature dependencies.
- View Feature Elements - Adds subnodes to the Feature node to drill down into feature element definitions. Also allows to open the XML definition of each element.
- Activate / Deactivate Feature - Adds a content menu item to each feature node to enable and disable the feature on the current site, site collection, web application or farm.
- List Site Columns - Browse site columns and view their properties.
- List Themes - Browse themes and view their properties.
- View Master Page and Page Layout Gallery - Adds the Master Page Gallery node which allows you to browse through Master Pages and Page Layouts. Additionally it allows you to view and edit the contents of the files from the Master Page Gallery.
- List Web Parts - Browse Web Parts and view their properties.
- Copy ID - Adds context menu items to various nodes to quick copy the unique ID value, for instance for features or content types.
- Copy Web Part - Copies the .webpart definition to the clipboard to quickly paste a Web Part into a <AllUsersWebPart> node.
- View List Event Receivers - Adds a subnode to the List node to drill down into Event Receivers associated with the List.
- View Style Library - Adds the Style Library node which allows you to browse through the contents of the Style Library. Additionally it allows you to view and edit the contents of the files from the Style Library.
- Get SPMetal Definition - Adds a menu item to lists and sites that allows you to generate the SPMetal definition for the given object.
- Create Page Layout from Content Type - Adds a menu to content types that allows you to generate the contents of a Page Layout for the given Content Type.
Content - Sandboxed Visual Web Part - A visual Web Part that can be deployed as part of a sandboxed solution.
- SP Metal Definition - Adds an SPMetal parameter XML file to the project and auto-generates the code based on that configuration using a Visual Studio Custom Tool (like resx files).
- Custom Action Group - Simple XML based custom action group project item SPI.
- Custom Action - Simple XML based custom action project item SPI.
- Hide Custom Action - Simple XML based hide custom action project item SPI.
- Delegate Control - Simple XML based delegate control project item SPI.
- Console Application - A SharePoint Console Application template to easily create scratch applications.
Deployment - Quick Deploy Commands - Adds a submenu to the context menu of SharePoint projects that allow you to quickly deploy using any deployment configuration.
- Auto Quick Deploy - If project-level properties are set, automatically copies deployed files into the SharePoint installation folder whenever a file is saved, or automatically copies deployed assemblies if the project is built.
- Copy Assemblies - Copies all deployed assemblies to the relevant BIN folders and the Global Assembly Cache, for use as part of an X-Copy quick deploy.
- Copy Files - Copies all deployed files into the SharePoint installation folder, for use as part of an X-Copy quick deploy.
- Install Features - Installs the feature into the SharePoint feature storage, for use as part of an X-Copy quick deploy.
- Upgrade Solution - Performs a solution upgrade instead of a retract / deploy combination.
- Recreate Site - Deletes the site collection and recreates it with the same name, type and settings. Used to quickly create a new greenfield for testing.
- Reset IIS - Resets the Internet Information Server which can be useful during testing of site definitions.
- Reset Timer Service - Resets the SharePoint timer service.
- Warm-up Site - Executes a HTTP request to the root of the current deployment site to warm it up after a IIS recycle.
- Install Web Application Content - Copies Web Application specific content from the SharePoint installation folder into the IIS web application folders.
- Run PowerShell Script - Executes PowerShell script(s)
Of course, we'd love to hear what you'd like to see us include in the next release. <Todd /> PS: This is so big, I thought it was worthy of an inaugural tweet!
Jan
17
Published: January 17, 2010 08:01 AM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
Jan
10
Published: January 10, 2010 08:01 AM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
Here are the steps I’m using to explore the Properties and Methods of the SP.* Namespaces: - Navigate to a SharePoint 2010 Blank Site
- Click on the Page tab (to load Fluent UI JavaScript files)
- Press F12 to launch the IE Dev Toolbar
- Click on the Script tab
- Press the Start Debugging button (do this before you set the breakpoint)
- Select the ScriptResource.axd file that includes MicrosoftAjax.debug.js in its header
- Search for: _onReadyStateChange
- Set a breakpoint on the first statement in this function (line 4708 in my build)
- Refresh the Page in the browser to run code to the breakpoint (be patient while it spins up)
- Click the Watch tab
- Click the Click to add... textbox
- Type SP and press <Enter>
- Explore...
Way easier than dinking around in the debug.js files! <Todd />
Jan
09
Published: January 09, 2010 04:01 AM by
Todd Bleeker
Powered by: Mindsharp and Summit 7
Check out: http://spg.codeplex.com  Download/Viewing Options: This initial drop includes the following (each with its related documentation): - DropLocation\Docs\Setup.txt
- Information about how to run the Visual Studio 2010 Solutions
- DropLocation\IntegrationTest\SPGLib\Readme
- Documentation on how to build and run the Integration Tests
- DropLocation\IntegrationTest\SPGLib\Microsoft.Practices.SharePoint.Common.Test.sln
- Integration tests (both xUnit and Web tests)
- DropLocation\Source\SharePoint 2010\Microsoft.Practices.SharePoint.sln
- SharePoint Configuration Manager and Service Locator (ported from 2007)
- Refactored SharePoint Logger (now supports areas/categories)
- DropLocation\Source\SharePoint 2010\Microsoft.Practices.SharePoint(With Tests).sln
- Unit tests developed with the PEX/Moles framework
Pex is an Automated White Box Testing Framework for .NET from Microsoft Research. Read about Pex, Stubs, Moles, QuickGraph, MbUnit, and Reflector Addins. I’m not "mocking" it, but it really isn’t my thing. Several videos can also be found on Channel9. <Todd />
|
|
|
|
|