Tuesday 28 May 2013

SQL Sever 2008 R2 has an unsupported version error in SharePoint product configuration wizard


I was trying to create a SharePoint 2013 development VM and came across this nasty error,

SQL server at "SQLSERVERNAME" has an unsupported version at "xxx.xxx.x.x" (IP address). Please refer to http://technet.microsoft.com/library/cc262485(office.15)?ocid=fwlink#section5 for more information on the minimum required SQL Server Versions and how to download them.






I also tried PowerShell to create a configuration database but got same error,



PS C:\Users\Administrator> New-SpConfigurationDatabase
cmdlet New-SPConfigurationDatabase at command pipeline position 1
Supply values for the following parameters:
DatabaseName: SharePoint_Config
DatabaseServer: MSSQLSERVER
FarmCredentials
Passphrase: myPass



I fixed the error by installing update for SQL Server by Microsoft to make it work with SharePoint 2013. I downloaded Microsoft® SQL Server® 2008 R2 Service Pack 1 from http://www.microsoft.com/en-us/download/details.aspx?id=26727

Running this setup will update your SQL Server R2 to SP1 which is requirement for SharePoint 2013.



Upgrading your MCITP : SharePoint Administrator 2010 to SharePoint 2013 Solution Expert


If you already earned MCITP : SharePoint 2010 Administrator certification then you can easily upgrade it to SharePoint 2013 Solution Expert by passing 417, 331 and 332 exams, as shown in picture below,



Source : http://www.microsoft.com/learning/en/us/mcse-sharepoint-certification.aspx#fbid=MDgfOwqPuct?upgradeable

There isn't any upgrade path came out yet(28-05-2013) for MCPD : SharePoint 2010 Professional developers to upgrade and get certified in SharePoint 2013.

Thursday 23 May 2013

Capturing iPad or iPhone traffic using Fiddler2

Recently I have been given a task to find out why iPad application isn't getting the "correct" data from our SharePoint environment. I don't know much about how iPad has been developed but I been told it's consuming custom web services. Hence I downloaded Fiddler2 to analyse iPad traffic and see what has been requested by iPad and what is it getting in return.

Once you downloaded Fiddler2 on your computer, you can add proxy details to your iPad as shown in picture below,




Enter IP address of your computer in front of Server Make sure your port number matches one on Fiddler2 by default it's "8888". You can change default port by going to Tools > Fiddler Options > Connections > Fiddler listens on port:  as shown in picture below,




Now if you also want to capture HTTPS (secured) traffic then check boxes as shown in picture below,




Next step would be clicking on "Export Root Certificate to Desktop" and sending certificate you just exported on desktop to your iPad through email. Once you received it on your iPad just try opening the certificate and install it.

That's it, you can start capturing traffic now, one thing I would like to mention is that my iPad and Computer has been connected to same intranet network while I was debugging.


Tuesday 21 May 2013

Restricting picture size in ItemAdding event receiver for SharePoint picture library


If you want to restrict user from uploading a picture larger then specified size (width x height) then you can use code below.

Please note it only works when user uploads a single picture file, when user uploads multiple files, SharePoint opens Microsoft picture manager to upload several pictures hence HTTP Context comes as null. I tried to find a fix for it but I couldn't so if someone reading this post please comment the solution. Until then you can disable multiple picture uploads to library.

Ways around would be create a custom list definition and then a custom upload form with all of code logic behind, you can make it work for single files or several files but depends on your code behind logic and requirements.



class PicLibraryImageSize : SPItemEventReceiver
    {
        HttpContext _current;
        public PicLibraryImageSize()
        {
            _current = HttpContext.Current;
        }

        public override void ItemAdding(SPItemEventProperties properties)
        {
            try
            {
                this.DisableEventFiring();

                if (IspicTooLarge())
                {
                    properties.Cancel = true;
                    properties.ErrorMessage = "Picture Too large to upload !";
                }
            }
            catch (Exception ex)
            {
                //Log it
            }
            finally
            {
                this.EnableEventFiring();
            }
        }

        private bool IspicTooLarge()
        {
            HttpFileCollection cFiles = _current.Request.Files;

            HttpPostedFile pFile = cFiles[0];

            using (System.Drawing.Image image = System.Drawing.Image.FromStream(pFile.InputStream))
            {
                if (image.Width > 800 ||  image.Height > 600)
                {
                    return true;
                }
                else
                    return false;
            }
        }
    }