Jan
17
2012

Replaceable parameters, or tokens, can be used inside project files to provide values for SharePoint solution

http://msdn.microsoft.com/en-us/library/ee231545.aspx

Jan
15
2012

Cisco VPN Client and Windows 8 Developer Build

Just to update, the legacy Cisco VPN client (5.0.07.0440 for x64, 5.0.07.0410 for x86) is working for some people. You need to apply a small workaround as explained below –

 

·    Open Registry editor by typingregedit in Run prompt

·    Browse to the Registry Key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\CVirtA

·    Select the DisplayName to modify, and remove the leading characters from the value data up to the last "%;" i.e.

o    For x86, change the value data from something like "@oem8.inf,%CVirtA_Desc%;Cisco Systems VPN Adapter” to "Cisco Systems VPN Adapter”

o    For x64, change the value data from something like "@oem8.inf,%CVirtA_Desc%;Cisco Systems VPN Adapter for 64-bit Windows” to "Cisco Systems VPN Adapter for 64-bit Windows”

·    Try connecting again

 

Please do revert back if this solution does not work.

Jan
12
2012

Tools for building CAML Queries

Checkout

  • U2U CamlQueryBuilder: http://www.u2u.be/Tools/wincamlquerybuilder/CamlQueryBuilder.aspx
  • Stramit Caml Viewer: http://spcamlviewer.codeplex.com/
Jan
12
2012

Master/Detail Pages in SharePoint 2007 (Idea 2)

http://www.sharepointdrive.com/blog/how-to-establish-a-parent-child-relationship-in-sharepoint/

I want to show you one of the ways how to quickly establish parent – child relationship in SharePoint. By using this way you will be able to add child items on the parent item view page as shown in the image below:
091709_0840_Howtoestabl1

The idea how to add new child item form is borrowed from OOTB SharePoint Blog application template. By investigating how comments are implemented on Post.aspx page I was able to reuse OOTB SharePoint:SubmitCommentButton control which is used by BlogCommentsForm SharePoint:RenderingTemplate. BlogCommentsForm rendering template is defined in Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx file. So here are quick steps how to achieve this:

  1. First you need a parent and child lists. In my example I have Orders and Oder details lists. In child list you need to create a lookup column to parent list named PostTitle (you must use this name because this is the name of column which is used by OOTB SubmitCommentButton functionality). It is important to choose ID column in the “In this column” combo box. You can hide PostTitle lookup column if you want.
  2. Now using SharePoint Designer 2007 open your site and navigate to the parent list folder. Copy DispForm.aspx and rename the copy CustomDispForm.aspx (you can choose whatever name you want).
  3. In the CustomDispForm.aspx replace ListFormWebPart with DataFormWebPart.
  4. Add new ListFormWebPart for the new child list item form. Choose New item form in List or Document Form dialog.
  5. Add child list Web Part for displaying all child list items.
  6. Set CustomDispForm.aspx to be the parent list default display form.
  7. In the DefaultTemplates.ascx find SharePoint:RenderingTemplate with ID=”BlogCommentsForm”. Select and copy all SharePoint:RenderingTemplate tag.
  8. Create new file SubmitNewProduct.ascx and paste the code you copied in step 7 (you can choose another file name).
  9. Find SharePoint:SubmitCommentButton tag and modify Text attribute to whatever you want (in my example I will use “Add Product”). Save the file in the same directory as DefaultTemplates.ascx.
  10. Using SharePoint Designer 2007 open CustomDispForm.aspx created in step 2. Find ListFormWebPart added in step 4. Change TemplateName tag to a name you named the file in step 8.
  11. Now when you open Order (parent list item) you already can add new child items. But last web part on page still displaying not filtered child items list. All you need to do is Edit the page and modify last web part by setting the following filter: PostTitle is equal to [ID].

In the next post I show how to implement a child item selection from another list. If you noticed in the image above Order details item have a lookup column name Product. By selecting Product automatically are filled child item fields. In others solutions it may be enough to have just a lookup column, but in my case I need to fix product details (name, price and etc.) at the time of Order or Invoice creation because later on product price may change.

 

Jan
12
2012

Master/Detail Pages in SharePoint 2007

http://aghy.hu/AghyBlog_EN/Lists/Posts/Post.aspx?ID=78

Sometimes (very often) we have to be faced with the user requirements of master-detail lists. If you want to implement a very basic one, it’s very simple: lookup fields can have very big strong. For example, you need to store company data with contact people:
 
  image
Well, how can you store these info pieces in SharePoint lists? – Of course, you’ll simply have two lists: first one for the companies, and the second one for the contact persons. In this second list you have to make a lookup column referring to the Companies list. In this column we’ll store the info where is that person’s working:
 image
That’s great, but in most cases that’s not enough. You can maintain companies and contacts in different spaces, in different lists. The main problems with this are the followings:
  1. You cannot see the related contacts on the Company’s form. For example, I’d like to have a form for Company1 where I can see Thomas, Spencer, Percy, Harvey and Harold.
  2. You cannot maintain the contacts directly from the companies data form. When you view/edit a contact person, you’ll be redirected to the contacts list’s AllItems.aspx instead of the related company’s DispForm.aspx.
So, would you like to know what I’m talking about? The default display form of a company is something similar this:
image
Instead of that, I’d like to see something like that:
image
I’m very sorry because of the Hungarian UI, but to be honestly this example is from my company’s Intranet site. Most probably you’re interested in a few words, so let’s start your first Hungarian lesson:
  • Ügyfél = customer
  • Kapcsolattartó = contact person
  • Bezárás = close
That’s it, I hope you understand everything else :)
Well, making a form like that is very simple, you just have to create a Data View webpart with SharePoint Designer. The source list of this Data View is the contacts list, filtered by the current company: create a custom company DispForm webpart based on the URL’s ID parameter, and you can connect this webpart to the Data Views. You need this trick just because the URL contains the company’s ID, but in the Data Views you need the name of that.
In the Data Views, all of the the items’ link redirect you to the selected contact person’s DispForm / EditForm – and very similar, the New Contact (“Új kapcsolattartó”) link placed in the footer of the webpart redirects you to the contacts list’s NewForm.aspx.
That’s well and good, but how are we redirected to the company’s page from these forms? – This step requires two little tricks. First of all, we have to tell the forms where to come back. It’s pretty easy, just place a parameter in the URL. For example, the New Contact (“Új kapcsolattartó”) link is something like this:
http://intranet/cust_site/Lists/Contacts/NewForm.aspx?CustomerID=112
where CustomerID is the ID of the current company, and you can read this from the URL as a QueryString parameter:
image
OK, we’re ready on the companies’ side, let’s jump to the contacts list. Here we should update all forms (DispForm.aspx, EditForm.aspx, NewForm.aspx) and learn them to redirect us to the related company’s DispForm instead of Lists/Contacts/AllItems.aspx. As the logic of this modification is similar on all these forms, let’s only see the NewForm.
First of all, what you have to do to change the default redirecting of Save and Cancel buttons is to replace the default NewForm webpart to a custom one. Changing the redirecting to a static URL is very simple, but in this case we need a dynamic URL in the redirection, because of the CustomerID parameter. Let’s dig into it and see the way of dynamic redirecting step-by-step:
  • Read the CustomerID parameter from the URL (see above).
  • Place the following snippet to the beginning of the Data View webpart’s code. With it you can build the redirect URL (RedirectLoc) in a dynamic way:
    <xsl:param name="CustomerId" />
        <xsl:variable name="RedirectLoc">/cust_site/Lists/Customers/DispForm.aspx?ID=<xsl:value-of select="$CustomerId" />
    </xsl:variable>
  • Finally, replace the default SAVE and CANCEL button to this ones:
    <input name="SaveButton1" type="submit" value="Save" onclick="javascr ipt: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={',$RedirectLoc,'}'))}"/>
    <input name="CancelButton1" type="button" value="Cancel" onclick="javascr ipt: {ddwrt:GenFireServerEvent(concat('__cancel;__redirect={',$RedirectLoc,'}'))}"/>
That’s it! Hope you like it – more to come, stay tuned!
 
Jan
12
2012

Need to write a CAML Query that filters against a Lookup Column?

There are two options to do this -- one is based on the value and the other on the ID.  Unfortunately MSDN doesn't provide any help at all on the 2nd option.

Standard what (based on value):

<Where>
    <Eq>
        <FieldRef Name=”Category” />
        <Value Type=”Lookup”>My category</Value>
    </Eq>
</Where>

And by ID:

<Where>
    <Eq>
        <FieldRef Name=”Category” LookupId=”TRUE” />
        <Value Type=”Lookup”>234</Value>
    </Eq>
</Where>
Jan
6
2012

IIS7: Moving the INETPUB directory to a different drive

Great article on what is involved in moving the IIS root folder in Server 2008 and newer OSs.

 

Having your content on a different partition than your Operating System is a good security practice. In previous IIS versions is was possible to do this during setup time in an unattend file. Due to changes in Vista and Windows Server 2008 setup it became impossible to do that however. After setup the IIS7 INETPUB directory will be on the same partition as Windows. Moving the INETPUB directory to a different drive has to be done after setup completes. Here is a table of configuration entries that use the INETPUB directory on a default install. An example in the right column shows how to move the setting to a different drive using the APPCMD command-line tool. Once all the settings are moved the only step left is to copy the INETPUB directory via XCOPY. Here is a link to a batch file (packaged up in MOVEIIS7ROOT.ZIP) that moves the INETPUB directory to a drive of your choice.

Directory Config setting location Example how to move setting to a different drive (this example uses the F:\ drive)
LOGS\FREBLOGS Failed Request Event Buffering (FREB) is a new IIS7 feature that logs failed requests. The default path for FREB logs is %systemdrive%\inetpub\logs\FailedReqLogfiles. %windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.traceFailedRequestsLogging.directory:"F:\inetpub\logs\FailedReqLogFiles"
LOGS\LOGFILES The default path for IIS7 log files is %systemdrive%\inetpub\logs\logfiles. %windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/sites -siteDefaults.logfile.directory:"F:\inetpub\logs\logfiles"%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralBinaryLogFile.directory:"F:\inetpub\logs\logfiles"%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log -centralW3CLogFile.directory:"F:\inetpub\logs\logfiles"
TEMP\APPPOOLS AppPool isolation is a new feature in IIS7. A dedicated AppPool configuration file gets automatically created before a new Application Pool is started. The default location of these files is %systemdrive%\inetpub\temp\appPools  reg add HKLM\System\CurrentControlSet\Services\WAS\Parameters /v ConfigIsolationPath /t REG_SZ /d f:\inetpub\temp\appPools 
HISTORY Configuration history ensures that changes can be rolled back. The default location for configuration history is %systemdrive%\inetpub\history %windir%\system32\inetsrv\appcmd set config -section:system.applicationhost/configHistory -path:f:\inetpub\history
TEMP\ASP COMPILED TEMPLATES Classic ASP stores compiled ASP code on disk if more than 250 compiled templates are in memory. The default disk cache location is "%systemdrive%\inetpub\temp\ASP Compiled Templates" %windir%\system32\inetsrv\appcmd set config -section:system.webServer/asp -cache.disktemplateCacheDirectory:"f:\inetpub\temp\ASP Compiled Templates"
TEMP\IIS TEMPORARY COMPRESSED FILES IIS7 will cache compressed responses on disk if necessary. The default location for the compression cache is "%systemdrive%\inetpub\temp\IIS Temporary Compressed Files" %windir%\system32\inetsrv\appcmd set config -section:system.webServer/httpCompression -directory:"f:\inetpub\temp\IIS Temporary Compressed Files"
WWWROOT IIS7 comes with a Default Web Site which points to %systemdrive%\inetpub\wwwroot. %windir%\system32\inetsrv\appcmd set vdir "Default Web Site/" -physicalPath:f:\inetpub\wwwroot
CUSTERR IIS7 stores Custom Error Pages in %systemdrive%\inetpub\custerr %windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='401'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='403'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='404'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='405'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='406'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='412'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='500'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='501'].prefixLanguageFilePath:f:\inetpub\custerr%windir%\system32\inetsrv\appcmd set config -section:httpErrors /[statusCode='502'].prefixLanguageFilePath:f:\inetpub\custerr
WWWROOT and FTPROOT Locations Service Packs and other installers need to know where your WWWROOT and FTPROOT directory is. That's why the location is also specified in the registry.

reg add HKLM\Software\Microsoft\inetstp /v PathWWWRoot /t REG_SZ /d f:\inetpub\wwwroot
reg add HKLM\Software\Microsoft\inetstp /v PathFTPRoot /t REG_SZ /d f:\inetpub\ftproot

 

MOVING THE CONTENT:

Once the configuration is changed you have to copy all content from your root drive to your new drive including ACLs and empty directories:

Example:

                    xcopy c:\inetpub f:\inetpub /E /O /I

 

/E copies all directories even if they are empty
/O copies all security settings, i.e. Access Control Lists on files and directories
/I assumes the destination is a directory

PLEASE BE AWARE OF THE FOLLOWING:
WINDOWS SERVICING EVENTS (I.E. HOTFIXES AND SERVICE PACKS) WOULD STILL REPLACE FILES IN THE ORIGINAL DIRECTORIES. THE LIKELIHOOD THAT FILES IN THE INETPUB DIRECTORIES HAVE
TO BE REPLACED BY SERVICING IS LOW BUT FOR THIS REASON DELETING THE ORIGINAL DIRECTORIES IS NOT POSSIBLE.

Local copy of download

moveiis7root.zip (1.66 kb)

Jan
6
2012

Looking for a way to list a row count for every table in a database? Look no further...

SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC
GO
Jan
5
2012

Google Calendar Sync upgrades Outlook 2010 support

Repost from here...


Making sure that your calendar is available to you whenever and wherever you need it is important. That's why Google Calendar works with a number of desktop applications and mobile devices including iCal, iPhone and iPad, Blackberry, Android, Nokia/Symbian, and Windows Mobile phones. Google Calendar Sync for Outlook is also available, but one thing was missing — until now.

Google Calendar Sync now supports Outlook 2010 — our top feature request. Outlook 2010 comes in 32-bit and 64-bit versions. To start syncing your calendar with Outlook 2010, download Google Calendar Sync version 0.9.3.6 (google direct download).  Once you install it, a Settings window will appear. Enter your account’s email address and password, choose your sync option and sync frequency, and you’re done! (Note: If you’re already using Google Calendar Sync, you’ll still need to download and install this new version in order to be able to sync with Outlook 2010. If you need help, take a look at our getting started guide.)

 

Nov
22
2011

Tool for working with .NET config file transforms

Check out this great tool for working with .NET config file transforms

http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx