Posts

Showing posts from 2011

SqlCeException was unhandled. The operating system does not support the encryption mode provided.

Image
SqlCeException was unhandled
The operating system does not support the encryption mode provided.

The environment is:
Windows 7 Home PremiumVisual Studio 2008.Net Framework v3.5, SQL Compact v3.5
If ever you get this message on your PocketPc project when you are opening the connection, it is most likely because your database is encrypted with a password. Just remove the password (which will decrypt the database), save it back and run your code. It should now go through fine.

SharePoint programmatically managing item permissions

Assigning SharePoint List Item level permission programmatically
To add item level permission in an SharePoint List or Library, you need to keep three things in mind:
You have a valid SPUser object in your hand
You have to break the role assignment inheritance for the list
You have to add Role Definition and Role Assignment to the targeted list item
Though above statements looks complicated, don't think much about them – just use following two functions wisely and you are done :)
Assumption:
1. You have SPListItem object in your hand
2. You have a valid SPUser in your hand
Working:
First call the below method and pass the SPListItem as the input parameter:

RemoveAllPermissions Function privatestaticvoid RemoveAllPermissions(SPListItem CurrentlistItem)        {//The below function Breaks the role assignment inheritance for the list and gives the current list its own copy of the role assignments            CurrentlistItem.BreakRoleInheritance(true);//Get the list of Role Assignments to …

PeopleEditor Control Development

Cross Site Lookup and Parent Site Lookup

At many instances, we look for having a centralized master list that can be accessed across all SharePoint sites. We end up writing custom code to do that or in 2010, try and use the Enterprise Managed Metadata functionality.

However, giving access for users to update this and also have them available as a picker in the Lists and Libraries is a challenge.

CodePlex / Dev4Side have the Filtered Lookup which can be used to access a Master List in the parent site from subsites
http://dev4side.com/projects/sharepoint-2010-filtered-lookup-field.aspx

I tried this on my SP 2010 environment and it works fine, just ensure, you do an IISReset after Adding and Deploying this solution.

One caveat though: if you try to customize a SharePoint list using InfoPath with this field in it, it is not going to work :)

Email as attachment - codeplex solution works

Image
SharePoint has "Email as a Link" for all document libraries, but not "Email as attachment". How handy would it be when you need to send a document that is present inside a Document Library to external people with just their e-mail id.
Found a solution in CodePlex and it really works fine.


It works for single selection as well as multi-selection http://sendemailsp2010.codeplex.com/
Steps: 1.Add .WSP 2.Deploy from Manage FARM Solutions 3.Activate Site Collection Feature 4.Then Add Site to Trusted Sites, in the Trusted Sites -> Custom Level, you need to enable the below setting Once you are done with this, you  will see your document library as below:


Updating hyperlink fields programmatically

Data in the Hyperlink Column can be populated / set in the following manners: Item[“HyperLinkColumnName”] = “http://www.google.com, Google”; Item.Update(); Don’t forget space after comma. Or SPFieldUrlValue MyURL = new SPFieldUrlValue(); MyURL.Description = “Google”; MyURL.Url = http://www.google.com; Item[“HyperLinkColumnName”] = MyURL;
Data from the Hyperlink Column can be get in the following manner: SPFieldUrlValue MyURL = new SPFieldUrlValue(Item[“HyperLinkColumnName”].ToString()); string URLText = MyURL.Description; string URL = MyURL.Url;

Nice DropBox and Document Rating Add-On for SharePoint 2010

SharePoint 2007 documents opening as read-only

Consider the following Scenario: On Windows Vista, Windows 7 or Windows 2008 systems with Office 2007 or Office 2010 installed and Internet Explorer 7 or Internet Explorer 8, you attempt to open files from a SharePoint site using a Fully Qualified Domain Name (a URL including ‘.’ in the site name).The SharePoint 2007 is hosted on Windows 2008 or 2008 R2 Server with WebDav enabled.The SharePoint 2007 site is setup to use Windows Authentication.Users of the SharePoint site are expecting Client Integration (being able to edit and save directly back to the server) to be functional.In this scenario, a user may see one or more of the following symptoms: The user is prompted unexpectedly to enter their credentials. The Office document will open in Read Only.  When opening SharePoint Explorer View an error will occur showing the path to the Document Library and a message of "Not Implemented". When trying to save from Office back to a SharePoint site directly doing a Save As will not b…

Managed Properties in FAST 2010 Search Server

Is there a difference between creating Managed Properties between SharePoint 2010 Search and FAST 2010 Search?

The answer here is: Yes… the process of making a property searchable is a bit different between FAST and SP Search.
FAST can only filter/property search on Managed Properties. Managed Properties are derived from crawled properties and are not automatically created like in SP Search.
FAST does come with some default Managed Properties like Author, Site, Name, etc… and that’s why those properties work on you FAST system and not the newly created “Reference No”.
Here are the instructions on how to list/add/edit a Managed Property in FAST.
http://office.microsoft.com/en-us/fast-search-server-help/property-management-HA010382016.aspx#_Toc251751310
Try creating a managed property for your fields, recrawl, test searching on that managed property.

Windows 2008 R2 taking forever to start when dcpromo is done

Had been trying to set up a Windows 2008 R2 machine at home since last Saturday.

But i kept getting bug by this issue where Windows is taking FOREVER to boot. when i mean FOREVER, it meant like ~1 hour, when i finally gave up waiting and just reset the machine.

I tried living with it, but figured out that something is really wrong. I should point out that i had dcpromo-ed the installation.

I had had older windows DC taking like 5 mins or so to boot up because it was the only domain controller and DNS server on the network. But this was really unusual.

I tried booting from safe mode and it freezes after loading classpnp.sys. Google wasn’t exactly helpful. Tons of people seems to be stuck loading this driver because of various reasons.

So i reinstalled the installation and tested it step by step. windows updates had no issue, drivers had no issue, and it happens right after i do dcpromo.

After search on the web this time, i found out dcpromo will attempt to disable write caching on the…

SharePoint Mobile Integration

For all devices – iPhone, Blackberry, Android, Symbion http://www.noko.co.uk/what_we_do/solutions_for_sharepoint_2007/sharepoint_for_smartphones.aspx
For iPhone only http://www.moprise.com/ For iPhone only http://itunes.apple.com/gb/app/ishare/id305862898?mt=8 (Spyk Software) For Blackberry Only http://silverdust.softartisans.com/blackberry-sharepoint-mobile-integration-use-cases-457.aspx For Blackberry Only http://www.wicksoft.com/sharepoint_summary.htm

Noko – Mobile Entrée Base Plugin The Mobile Entrée Base Plugin provides out of the boxconfigurable access to:
·Search - with a configurable scope
·Lists - Control which lists and views are made available to mobile users (includes support for Announcements,Calendars, Tasks and Links)
·

The unattend answer file contains an invalid product key. Either remove the invalid key or provide a valid product key in the unattend answer file to proceed with windows installation

Image
If ever you have tried using VMWare Workstation to install Windows OS, as soon as you select the .iso image, it will prompt you for the product key and you would have entered the same. But once the installation starts, it will give you this message.

The unattend answer file contains an invalid product key. Either remove the invalid key or provide a valid product key in the unattend answer file to proceed with windows installation

All you need to do is, Power Off the VM. Open the autoinst.flp file, find where the product key is and re-type it... guess this is a bug with VMWare which adds some special characters to the product key when given initially.

Once you have saved back the file, you can re-start the installation and it will go through successfully.
Screenshots below:




SharePoint 2010 PerformancePoint Services with Analysis Services (SSAS) Cube

PerformancePoint Services and its Dashboard Designer are touted to be wonderful things that came free with SharePoint 2010! A kind of a monster product that independently existed (as PerformancePoint Server 2007 before) to be now available with our beloved SharePoint...

When you start PPS, you start facing it's instability and unfriendly nature of guiding you through creating great BI Solutions.

Microsoft BI - one thing that people always think, great, Microsoft allows us to pull data from Tabular data such as Excel Sheets, SharePoint Lists and SQL Server Tables and create Charts, Scorecards, KPIs and perform Analysis - and it is always thought that, you really do not need to have your SSAS Cubes created (this always is a mystery for many!).

Actually, you will soon realize that, you can realize the full potential and power of PPS, only if you have your Data Source really as Analysis Services Cubes.. Infact, apart from KPIs and Scorecards (which is just a grouping of your KPIs), yo…

Trying out WebMatrix - just amazing!

Image
http://www.microsoft.com/web/webmatrix/

I saw the launch of this new tool (and free!) from Microsoft today... downloaded and installed it, oh boy so amazing... embraces all tools around - be it MS or Non-MS, guess you can build a CMS enabled website within hours and publish it!

I used to always think about the demise of tools like FrontPage, PhotoDraw and here comes WebMatrix, something that can possibly start matching DreamWeaver sooner than later!

Some screenshots below...just go ahead and immerse yourself!



Using External Content Types with Stored Procedures with Input Parameters

Image
You must have tried External Content Types - the exciting new feature in SharePoint 2010 to connect to an external SQL table and provide a list where it lists, creates, updates data straight into the SQL table.

People always wonder, how do you get a ECT to work with a Stored Procedure, one that has input parameters.

You could do it this way...

Step 1: In your SharePoint Designer 2010, create a new external content type
Step 2: Connect to your SQL Server and then make sure you see the Routines (your stored procedures must be listed here)
Step 3: Rt Click on the Stored Procedure name and create operations for "Read Item" and "Read List" - both are required for the External Content Type's SharePoint list to be created.
During both these wizards, in the Input Parameters, your SP's Input Parameter will be listed. Here, you need to create a filter, which sends out it's value to the SP's filter. For example, if your SP's Input Parameter is @EmpID, and…

Error occurred in deployment step ‘Recycle IIS Application Pool’: Invalid namespace

If you ever encounter this error with a SharePoint 2010 Environment on Windows 7,

Ensure, you enable this:
Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS 6 WMI Compatibility

SharePoint Datasheet View

If SharePoint 2007 or 2010 Datasheet View is not working, you need to install:
Access 2007 Download: Access Runtime
http://www.microsoft.com/downloads/en/details.aspx?familyid=d9ae78d9-9dc6-4b38-9fa6-2c745a175aed&displaylang=en

Or
2007 Office System Driver: Data Connectivity Components
http://www.microsoft.com/downloads/en/details.aspx?familyid=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en

In every client machine!

Arabic Language Pack on SharePoint 2010 running on Windows 7

If ever you want to install Arabic Language Pack on SharePoint 2010 running on Windows 7, you will get a pre-requisite requirement of having Windows Server 2008 OS.

To overcome this, you need to do a similar change to the files\setup\config.xml the way you did in the SharePoint 2010 install.

Extract the Arabic Lang Pack using /extract switch to a folder. Edit the config file to add the below line.

The following needs to be added.

<Setting Id=”AllowWindowsClientInstall” Value=”True”/>

Windows Server 2008 R2 Blue Screen due to Hyper-V

Windows Server 2008 too can give you a blue screen!

I had tried adding the Hyper-V role on a Windows Server running on a laptop and guess what it gave me the blue screen of death!

Even though I though Windows was smart enough to detect (it got restarted and said, hyper-v has failed so removing it) and remove it, it wasn't just doing it...

Windows 7 Blue Screen because of ConnectiFy

I had installed ConnectiFy on the other day in order to convert my Windows 7 machine as an Wireless access point, but it ended up giving me blue screen of death in my Windows 7. This is the first time I am seeing this on Windows 7 in over an year!

Even in safe mode, I could not uninstall the ConnectiFy drivers which got clinged onto all network adapters.

So be careful!

Validate a SharePoint Date Field against Current Date in Javascript

Consider the following scenario:


You have a SharePoint Site which has its regional settings set to English (UK) - so that the date format becomes dd/mm/yyyy in all date pickersYou would like to validate a particular date field in your List or Document Library against the current dateIf the validation does not pass, you should not allow the form to save
So what the script does is:
Uses the sputility (check my previous posts and also look at http://sputility.codeplex.com) to get the particular SharePoint date fieldIt comes out as a date datatype, so I cast it to stringSince the format is in dd/mm/yyyy and Javascript compare and date functions work only with mm/dd/yyyy, I am converting them back to that formatthen using UTC string conversions and comparing...Enjoy!
<script type="text/javascript">
function PreSaveAction() {  var createdate = SPUtility.GetSPField('Date of Creation').GetValue();  var createdatestr=createdate.toString();         var dt1  = createdatestr.subst…

SharePoint Configuration Wizard Failing - RPC Server is unavailable

Image
If you encounter this issue, it is clear that your SP machine is unable to get the credentials verified with the Active Directory.

Try ipconfig /flushdns - and if it still does not work, do ipconfig /registerdns

Validating Taxonomy Metadata Field in Javascript (Multiple Value Field)

In my previous post, I had mentioned about performing validation of a single value taxonomy field. This script does validation of a multi-value field.

This and the previous script works for how many ever taxonomy fields you have in the edit form. Now what I am trying to do is validate and prevent the user from saving the document if the same value repeats in those fields.
*******************************

<script type="text/javascript">
        function PreSaveAction() {
            //alert("calling before save")

            var iRef = document.getElementsByTagName("div");

            var arr = new Array();
            var duplicate = false;
            var errors = new Array();

            for (var i = 0; i < iRef.length; i++) {
                if (iRef[i].id.indexOf("editableRegion") >= 0) {
                    var itemFound = iRef[i];
                    if (itemFound.innerText.length == 1) {
                        continue;
      …

Validating Taxonomy Metadata Field in Javascript (Single Value Field)

Many of us have requirements of validating Metadata Fields in the client side itself, thus giving a nice little alert message and avoiding save....very interactive and nice....

Find below a script that you can use for the same.

All you need to do is, go to your Document Library or List, Go to the Edit Form WebPart Page, add a Content editor WebPart, edit the HTML Source and put this script inside... below the Edit Form and Save the Page back (Page ribbon -> Stop Editing)....

The script is inside the PreSaveAction() that is called by the SharePoint Save method, which if returns false, the validation is considered failed and SharePoint does not save the data..
--------------------------------------------------

<script type="text/javascript">
function PreSaveAction()
{

var iRef = document.getElementsByTagName("div");

var arr = new Array();

for(var i=0;i<iRef.length;i++)
{
  if(iRef[i].id.indexOf("editableRegion")>=0)
  {
    var itemFound = iR…