: +91-265-2775555
 : +1-714-786-6270
 : +45-4052-3137
 : +61-1300-887-156

 ‭(Hidden)‬ Admin Links

There are currently no favorite links to display.

 Blog image

 Tag Cloud

 Archives

There are currently no favorite links to display.

[Sharepoint] "There is not enough space on the disk" error executing Export-SPWeb

Today while trying to export a large subsite using Export-SPWeb command through powershell, we got error "There is not enough space on the disk". The command that we tried is as under:

Export-SPWeb -Identity "$siteurl" -Path "$exportfilepath" -IncludeUserSecurity -IncludeVersions all

Now the drive in which we were to export the contents had more then 250 GB of free space, and our content to export was around 170 GB. So the message didnt seem to make valid sence. Then after some research we came to know that the export command exports all contents to the windows TEMP folder (specified by %TEMP% environment variable) which normally is located in C drive, and then after completion of export command, transfers the result to our specified export file location. Our C drive had only 50 GB of free space, and so did the message make sence now as 50 GB was not enough to store 170 GB of data.

So the solution, we changed our %TEMP% environment variable to point to an empty folder on the drive with size more then our export file size.

Note:

  • environment variables on windows 7 can be reached at: my computer > advance system settings > Advanced tab > environment variables button.
  • to check your current %TEMP% folder location, type "ECHO %TEMP%" using command prompt.

Thus, while exporting sites in sharepoint, always make sure that the drive where the %temp% (environment variable) folder is located, has space more then your export file size (this can be known through the content database size), and if needed change %temp% environment variables location to drive with enough free space available.

---
Purnil Soni

[Sharepoint] Manage Content and Structure giving error in Sharepoint 2010

One fine day (or rather "not so fine day"), suddenly when i tried to use "Content and structure" link under "Site Administration" section on "Site Settings" page, I was greeted by the deadly sharepoint error screen showing nothing else but a correlation id.

When I saw the error for that particular corelation id in sharepoint logs, the error it logged was:

System.NullReferenceException: Object reference not set to an instance of an object.    at - Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.DeleteAllowed(Boolean checkPermissions)

From a blog i came to know that such error occur due to existing of any corrupt list (which may had corrupted due to its template being removed after creation). So I started clicking on each available list in "Site lists and libraries" page under "Site Settings", and voila, there was a list, on click of which it gave a new error page and a new correlation id. This time the error message was

List does not exist. The page you selected contains a list that does not exist.  It may have been deleted by another user.

But I had got the problematic list. Once the list was found, which was the cause of the problem, then the question was how to solve this issue. Another blog came to rescue for this purpose, which stated to delete the list using either stsadm or powershell commands. I used the below stsadm command to remove that corrupt list:

stsadm.exe -o forcedeletelist -url <your list url; eg. http://myserver:8080/site/listname>

Remember to run this command as administrator.

Once the command succeeds, i.e. removes the corrupted list, BINGOO..., the issue was solved. Now the "Content and structure" is available again for use.

---
Purnil Soni

[Sharepoint] "Web application at URL could not be found" exception while accessing sharepoint site through object model

Many new-comers to sharepoint may encounter this silly exception of "Web application at <URL> could not be found" while trying to instantiate SPSite object to a site url using sharepoint object model.

The exception message may look something like:

Unhandled Exception: System.IO.FileNotFoundException: The Web application at http://myserver could not be found. Verify that you have typed the URL cor
rectly. If the URL should be serving existing content, the system administrator
may need to add a new request URL mapping to the intended application.
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean con
textSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
at Sharepoint.Tools.SPResetAuthor.Main(String[] args) in C:\Users\Program.cs:line 27

We may keeping scratching our heads as to why the object model is not able to find the web-application at the specified url, when the same url works perfectly when used in an internet browser.

The problem is that you may be using a 64 bit Windows Operating system and the application that you are compiling is built for 32 bit system.

So how to figure this our?

  • Right click on your project in Visual Studio, select "Properties"
  • Select "Build" tab
  • Check the option selected in "Platform Target:" dropdown

Solution:

Set projects "Platform target" property value to be "Any CPU". Save these changed properties, rebuild your application, and you are good to go.

---
Purnil Soni

[Sharepoint] "stsadm" command giving "command line error"

Today while trying to run "addcontentdb" operation using stsadm utility, I encountered this strange message saying "command line error". After trying hard, checking the syntax (which was correct), and trying many times, ended up with same message.

The problem was with the hyphen character ("-"). Strangely, the command syntax which I had copied from a webpage, when pasted in command prompt, had been converted into hyphen character with different encoding due to which it looked like hyphen but was actually some other character.

So the solution, edit your command text directly in command prompt or notepad, and delete each hyphen ("-") character and type them in manually.

Doing this and then re-running the command, worked like a charm.

The article that proved helpful in this respect can be found here.

---
Purnil Soni

Hide mailbox from .net

For Hide mailbox by .net :

 

 

ICollection<PSObject> results;

// Create a runspace.

 

RunspaceConfiguration rc = RunspaceConfiguration.Create();

PSSnapInException snapEx = null;

PSSnapInInfo info = rc.AddPSSnapIn(

                "Microsoft.Exchange.Management.PowerShell.Admin",

                out snapEx);

 

Runspace myRunSpace = RunspaceFactory.CreateRunspace(rc);

myRunSpace.Open();

// Create a pipeline...

Pipeline pipeLine = myRunSpace.CreatePipeline();

 

using (pipeLine)

{

// Create a command object so we can set some parameters

// for this command.

Command newMbx = new Command("Set-mailbox");

newMbx.Parameters.Add("Identity", name);  // Name of MaileBox i.e domain name of User.

newMbx.Parameters.Add("HiddenFromAddressListsEnabled", true);

               

 

pipeLine.Commands.Add(newMbx);

// Execute the pipeline and save the objects returned.

 

results = pipeLine.Invoke();

 

// Print out any errors in the pipeline execution

// NOTE: These error are NOT thrown as exceptions!

// Be sure to check this to ensure that no errors

// happened while executing the command.

 

if (pipeLine.Error != null && pipeLine.Error.Count > 0)

 {

   foreach (object item in pipeLine.Error.ReadToEnd())

      {

 

         // throw new InValidDirectorySyntext(item.ToString());

        }

 

   }

 

}

 

 

pipeLine = null;

myRunSpace.Close();

myRunSpace = null;

 

For UnHide mail box

you need to put

newMbx.Parameters.Add("HiddenFromAddressListsEnabled", false);

 

Namespace  :

using System.Management.Automation;

using System.Management.Automation.Runspaces;

using System.Management.Automation.Host;ICollection<PSObject> results;

 

Hope this will be help while you doing Exchange server communication from .net

Populate InfoPath Dropdown list programmatically

Steps

-          Open InfoPath 2010 form in design mode

-          Create a XML document, which will work like a template for Dropdown list.

 

<?xml version="1.0" encoding="UTF-8" ?>

<options>

<option><value/><displayname/></option>

<option><value/><displayname/></option>

</options>

 

-          Create a new data connection which will point to XML document

 

Manage Data Connections

 

-          Click on “Manage Data Connections…”

 

Data Connection List

 

-          Click on “Add” that will bring you a Wizard for data connection

 

data connection add page 1

 

-          We are intended to get some data for Dropdown list, so we will select “Receive Data” option.

 

data connection add page 2

 

-          We have created a XML document, so will select “XML document” option.

 

data connection add page 3

 

-          We will use our XML document as a resource file.

 

list resource files

 

-          Click on “Add” & it will ask you for a XML file.

 

data connection add page 4

 

-          Give proper name to the data connection & finish the wizard.

 

datasource list          datasource list fields

 

-          You can see the new data connection available in “Fields” window, select that new data connection & you can see the structure of the data connection fields.

 

ddl country context menu

 

-          Now it’s time to bind the data connection fields to the Dropdown list, so go to its properties.

 

ddl country property

 

-          Select the data source as our newly created data connection.

 

ddl country select entity

 

-          Select entries as our repeating group (i.e. option).

 

ddl country property filled

 

-          Select appropriate value field & display name field.

 

ribbon bar

 

-          Now, it’s time for some programming, so first select the “Language” option under Developer tab of Ribbon Bar.

 

programming language & project

 

-          Select the programming language & the location of the Project.

 

ribbon bar loading

 

-          Now, select the “Loading Event” under Developer tab of Ribbon Bar & it will open up a Visual Studio with a project.

 

 

 

using Microsoft.Office.InfoPath;

using System;

using System.Xml;

using System.Xml.XPath;

 

namespace Form1

{

    public partial class FormCode

    {

        public void InternalStartup()

        {

            EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);

        }

 

        public void FormEvents_Loading(object sender, LoadingEventArgs e)

        {

            LoadCountries();

        }

 

        private void LoadCountries()

        {

            RemoveFirstItem(); //Remove extra Item from top

 

            AddItem("IN", "India");

            AddItem("US","United States of America");

            AddItem("UK", "United Kingdom");

 

            RemoveFirstItem(); //Remove extra Item from top.

        }

 

        private void RemoveFirstItem()

        {

            // get the XML dom from the datasource

            XPathNavigator DOM = DataSources["myXmlTemplate"].CreateNavigator();

 

            // get the repeating entity (options) from XML dom

            XPathNavigator group = DOM.SelectSingleNode("//options", NamespaceManager);

 

            // get the single entity (option) from XML dom

            XPathNavigator field = DOM.SelectSingleNode("//options/option", NamespaceManager);

 

            // delete entity

            field.DeleteSelf();

        }

       

        private void AddItem(string itemId, string itemName)

        {

            // Get the XML dom from the datasource

            XPathNavigator DOM = DataSources["myXmlTemplate"].CreateNavigator();

 

            // Get the repeating entity (options) from XML dom

            XPathNavigator group = DOM.SelectSingleNode("//options", NamespaceManager);

 

            // get the single entity (option) from XML dom

            XPathNavigator field = DOM.SelectSingleNode("//options/option", NamespaceManager);

 

            // make a clone of the first entity in XML dom & set new values

            XPathNavigator newNode = field.Clone();

            newNode.SelectSingleNode("value").SetValue(itemId);

            newNode.SelectSingleNode("displayname").SetValue(itemName);

 

            // append the new item in repeating entity (options)

            group.AppendChild(newNode);

        }

    }

}

 

-          Finally, here is the result.

 

final result

 

 

 

Telerik MVC Upload Control

Download Telerik library from

http://www.telerik.com/products/aspnet-mvc.aspx

To see demo of uplod control, visit

http://demos.telerik.com/aspnet-mvc/upload

Reason to write this Blog:

Many times we require to get some status message after saving files e.g. FileId from database.

In this case when we pass non empty string from action, telerik considers it as error. Here in this blog i had mentioned steps to overcome this error.

Telerik Upload control provides multiple files upload simultaneously sync/async.

 @(Html.Telerik().Upload()

        .Multiple(true)

        .Name("UploadFile")

        .ClientEvents(t => t.OnError("UploadFile.error").OnUpload("UploadFile.Upload"))

        .Async(t => t.AutoUpload(false)

  .Remove("Remove", "UploadFiles")

         .Save("Save", "UploadFiles")))

 

When we pass message from save(), it throws alert box with message "Error! Upload failed. Unexpected server response - see console." To override it:

1:  Get Object

Get the object of uploading control and override its existing method which generates error message.

var r = $("#UploadFile").data("tUpload");

r._alert = function (ee) { };

$("#UploadFile").data("tUpload", r);

 

_alert() is the function which generates error message when response from save() is non empty.

2:   Get response text from Save()

As we return status, it will fire UploadFile.error().

UploadFile.error = function (e) {

    UploadFile.filename = e.files[e.files.length - 1].name;

    UploadFile.statusMsg = e.XMLHttpRequest.responseText;

    if (e.XMLHttpRequest.responseText.indexOf("Success") < 0) {

        UploadFile.Status = "error";

    }

    else {

        UploadFile.Status = "success";

    }

};

 

XMLHttpRequest.responseText is the value of status sent from Save() by which you can distinguish with actual uploading error or the successful status message.

 

3: Change Classes to get correct output

Here, file is uploaded success fully. Though it shows with red mark as error.

 

Error File

We need to work on Jquery to get correct output:

Success File

$(".t-file .t-fail").removeClass("t-fail").addClass("t-success");

$(".t-file .t-success").html("uploaded");

$(".t-file .t-success").parent().find('.t-retry').removeClass("t-retry").addClass("t-delete");

$(".t-file .t-success").parent().find(".t-delete").parent().html("<span class='t-icon t-delete'></span>delete”);

 

4: Override function _removeFileEntry()  to get more functionality

When you click on delete button it will just remove the file list from div, and call Remove() of controller. But if you want to handle some features from Jquery, like remove FileId from list of FileId stored in hidden field, override _removeFileEntry() of telerik uploader as:

 

var r = $("#UploadFile").data("tUpload");

r._removeFileEntry = function (v) {};

$("#UploadFile").data("tUpload", r);

 

Thanks,

Posted By: Priyanka Shah

SharePoint site first load is very slow.

The sharepoint site is very slow when we access it first time. After that the response time is good. The reason is compilation and caching which takes time after application pool is recycle. To handle this we need to warm up the server whenever recycle happens. Here is a good link that explains about server warm up: http://blogs.msdn.com/b/joelo/archive/2006/08/13/697044.aspx So the idea is to schedule a job that pings the server whenever reset occurs.

You need to be a site collection administrator to set this property.

Sometimes you may receive error "You need to be a site collection administrator to set this property." even if you are a site collection administrator.
 
Resolution:
 
The site collection was locked. You need to unlock it via central admin. Go to central admin and unlock it (_admin/sitequota.aspx) by selecting the option "Not Locked".

E-signature using  Docusign

Docusign provides e-signature to documents. We can send document to as many recipients and get their signs using Docusign. This functionality can be accessible through its Member console. If you want to integrate Docusign with your application, you can use its API.

 

Here in the blog I had used its demo service. You can get API from:

https://demo.docusign.net/api/3.0/api.asmx

 

When we send a document to Docusign for sign, it creates an envelope. This Envelope contains document, recipients who will review or sign the document, Tabs with where to put signature, or Custom tab.

 

Now let’s start the process of sending documents and sign them through API.

Add the above link to service reference of the project. (Here, service reference name is “DocuSignWeb”)

How to send document:

CreateAndSendEnvelope  function of API Service is used to send the document to Docusign. To use this function follow steps.

Step 1:  Create Recipients

Docusing creates two types of Users: Embedded and Remote

Embedded user requires authentication while retrieving document, where remote user is not allowed to get the document. Whole process is handled through email in remote user.

 

DocuSignWeb.Recipient r = new DocuSignWeb.Recipient();

r.Email = email;

r.UserName = firstName + " " + lastName;

r.Type = DocuSignWeb.RecipientTypeCode.Signer;

r.RequireIDLookup = false;

r.ID=1.ToString(System.Globalization.CultureInfo.InvariantCulture);

 

If you are creating embedded user then it will require CaptiveInfo:

 

r.CaptiveInfo = new DocuSignWeb.RecipientCaptiveInfo();

r.CaptiveInfo.ClientUserId = clientUserId;

r.SignatureInfo = new DocuSignWeb.RecipientSignatureInfo();

r.SignatureInfo.SignatureInitials = (firstName.Length > 0 ? firstName.Substring(0, 1) : "") + (lastName.Length > 0 ? lastName.Substring(0, 1) : "");

r.SignatureInfo.FontStyle = DocuSignWeb.FontStyleCode.BradleyHandITC;

r.SignatureInfo.SignatureName = firstName + " " + lastName;

 

CaptiveInfo.ClientUserId is unique for each envelope. (E.g. SessionId). It is used for authentication when we retrieve this document.

 

Step 2: Add Document

DocuSignWeb.Document doc= new Document();

doc.ID = 1.ToString(CultureInfo.InvariantCulture);

doc.Name = documentName;

using (System.IO.FileStream streamReader = new System.IO.FileStream(fullFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read))

{

      byte[] pdfBytes = new byte[streamReader.Length];

      streamReader.Read(pdfBytes, 0, (int)streamReader.Length);

      doc.PDFBytes = pdfBytes;

}

 

Step 3: Create Tabs

DocuSignWeb.Tab tab=new DocuSignWeb.Tab();

tab.DocumentID= doc.ID;

tab. RecipientID = recipient.ID;

tab.Name = name;

tab.TabLabel = name;

tab.PageNumber = pageNumber;

tab.XPosition = XPosition;

tab.YPosition = YPosition;

tab.Type = DocuSignWeb.TabTypeCode.SignHere

 

If Tab is Custom Type then,

 

tab.Type = DocuSignWeb.TabTypeCode.Custom;

tab.SharedTab = true;

tab.Value = value;           

 

If SharedTab property is true, that means all recipients can change the value of that tab.

Step 4: Create Credential

DocuSignWeb.APIServiceSoapClient apiService = new DocuSignWeb.APIServiceSoapClient("APIServiceSoap", "https://demo.docusign.net/api/3.0/api.asmx");

apiService.ClientCredentials.UserName.UserName = "[" + IntegratorsKey + "]";

apiService.ClientCredentials.UserName.UserName += APIUserEmail;

apiService.ClientCredentials.UserName.Password = Password;

 

This credentials you can get from your Member console of Docusign site.

Step 5:  Create Envelope

DocuSignWeb.Envelope envelope = new DocuSignWeb.Envelope();

envelope.Subject = "DocuSign Test Document.";

envelope.EmailBlurb = "Hello!  This was submitted from a sample application";

envelope.Recipients = lstofRecipients;

envelope.AccountId = AccountId;

envelope.AllowMarkup = true;

// assign the document array

envelope.Documents = new DocuSignWeb.Document[lstofdoc.Length];

for (int i = 0; i < documents.Length; ++i)

{

            envelope.Documents[i] = lstofdoc[i].Document;

       }

 

// assign the tabs to the envelope

envelope.Tabs = lstoftabs.ToArray();

 

envelope.CustomFields = fields;

envelope.EnvelopeAttachment = attachments;

 

DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateAndSendEnvelope(envelope);

 

With this document is sent to Docusign.

How to sign document:

RequestRecipientToken function is used to retrieve URL of the document stored in Docusign. We can pass this URL to iframe in our aspx page. To use this function follow steps.

Step 6: Create RequestRecipientTokenAuthenticationAssertion

public DocuSignWeb.RequestRecipientTokenAuthenticationAssertion MakeRecipientTokenAuthAssert(string assertionId)

        {

            DocuSignWeb.RequestRecipientTokenAuthenticationAssertion assert = new DocuSignWeb.RequestRecipientTokenAuthenticationAssertion();

            assert.AssertionID = assertionId;

            assert.AuthenticationInstant = DateTime.Now;

            assert.AuthenticationMethod = DocuSignWeb.RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;

            assert.SecurityDomain = "Loan Demo";

 

            return assert;

        }

 

AssertionId value is informational for you to refer to the recipient. It can be ApplicaionId.

 

Step 7: Create RequestRecipientTokenClientURLs

public DocuSignWeb.RequestRecipientTokenClientURLs StandardUrls(System.Uri urlBase, string userName)

        {

            DocuSignWeb.RequestRecipientTokenClientURLs urls = new DocuSignWeb.RequestRecipientTokenClientURLs();

            urls.OnSigningComplete = urlBase + "?event=SignComplete&uname=" + userName;

            urls.OnViewingComplete = urlBase + "?event=ViewComplete&uname=" + userName;

            urls.OnCancel = urlBase + "?event=Cancel&uname=" + userName;

            urls.OnDecline = urlBase + "?event=Decline&uname=" + userName;

            urls.OnSessionTimeout = urlBase + "?event=Timeout&uname=" + userName;

            urls.OnTTLExpired = urlBase + "?event=TTLExpired&uname=" + userName;

            urls.OnIdCheckFailed = urlBase + "?event=IDCheck&uname=" + userName;

            urls.OnAccessCodeFailed = urlBase + "?event=AccessCode&uname=" + userName;

            urls.OnException = urlBase + "?event=Exception&uname=" + userName;

            return urls;

        }

 

From here you could specify a different redirect target for each status event - signing completed, cancelled, error, etc. We just use one page with different Querystring params to indicate the event.

Step 8: Get Recipient object who is requesting for document

Follow Step 1

Step 9:  Request for document

Get DocuSignWeb.APIServiceSoap as Step 4.

And call:          

apiService.RequestRecipientToken(_envelopeId, recipient.CaptiveInfo.ClientUserId,  recipient.UserName, recipient.Email, assert, clientURLs);

 

This function will return URL for the document to be signed. From here recipient can sign document, decline to sign, sign later.           

 

Thanks,

Posted By: Priyanka Shah

 

1 - 10 Next