View stack trace for visual studio sharepoint deployment by enable diagnostics logging for SharePoint projects

Tags

, , , , , , ,


I have a problem in visual studio SharePoint projects deployment that when an error occurred there is no stack trace enabled that i can see the details of the error like that

VS Deployment Exception

So i found a solution to enable stack trace for SharePoint projects in visual studio by adding a registry key to enable diagnostics logging for SharePoint projects

  1. Open registry  editor  by open start up menu – > type run -> type regedit then click ok
  2. Create a DWORD key type , the name is “EnableDiagnostics” and value “00000001” under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools      “the “10.0” folder for visual studio 2010 and you can do the same in your visual studio version

enable diagnostics logging for SharePoint projects

  1. Restart the operating system
  2. Now i can see the details of deployment in the visual studio output window as image below and in which step it fails.

Visual Studio SharePoint Deployment Exception Stack Trace

Hope it will help.

Visual studio wsp deployment Error occurred in deployment step ‘Add Solution': Value cannot be null

Tags

, , , , , ,


Sometimes when you try to deploy your SharePoint solution from visual studio an error occurred

visual studio wsp deployment Error occurred in deployment step ‘Add Solution': Value cannot be null

The error comes because you opened “Elements.xml” in visual studio IDE when you deploy the solution ! it fails when the “FindConflicts()” method invoked during add solution step in visual studio deployment.

Two solutions to solve that :

  1. Simply close any “Elements.xml” file opened in visual studio IDE then deploy it will success :D
  2. Change deployment conflict resolution for your module from Automatic “the default value” to None – image below

deployment conflict resolution

That’s it !  :)

Set HTML attrbuites from SharePoint content type fields in page layouts

Tags

, , , , , , ,


The Problem / Example : Need to put the “alt” attribute in the HTML “img” element from a content type field “Title” in a custom page layout and the content type fields represented as a SharePoint controls like that

SharePoint Field Value Control

You can do that simply by CSS/ JQuery :

1-Hide the SharePoint control that represent the field value using CSS and give the span container an ID “Ex: spanTitle” :

Hide SharePoint Field Value

2-Write the HTML “img” element with attribute “alt” empty and give it an id “Ex:exampleImage”  :

HTML img element3-Write these lines of JQuery that will fetch the value from the hidden span and put it to the “alt” attrbuite in the “img” element :
Fetch SharePoint Control Value And pass it to HTML attrbuite

Thanks !

Bulk delete SharePoint workflow tasks with associated history items using PowerShell

Tags

, , , , , , ,


I Written this script to bulk delete old completed workflow tasks with related history items by specify the date that script will stop delete until it.

The script were treated to deal with a huge number of data.

Click here to download The script

Click here to download from TechNet Gallery

Notes:

1. Read the Instructions in the top of the file to set the script parameters

Bulk delete SharePoint workflow tasks with related history

Script Instructions part

Continue reading

Table of list template IDs and SPListTemplateType enumenration members in SharePoint

Tags

, , , , , ,


Table of list template IDs

Programming over SharePoint XML files needs List Template ID in many cases “List definitions xml , site deifnations xml , event receivers xml  ,etc..) , here is a table for list template IDs

Continue reading

Create SharePoint event receiver for sepcifc list

Tags

, , ,


When you create a new SharePoint event receiver from Visual Studio the Visual Studio asks you “What item should be the event source” – ” see image below”

For example if you choose the list template “Survey” that means your event receiver will applied in all lists from the type survey , but in the real work you need to specify a list instance which the event receiver will apply to it .

Continue reading

Understanding group by in LINQ by example

Tags

, , , , , , , , ,


We will describe it by a full example “the full code in the end of the post for copy”

In this example we will create 2 classes , the “Task” class which has the task properties and the “TasksGroupedItem” which has 3 properties:

-Task day :  it will contain the task day that we will group by

-List<Task>  : it will contain list of tasks per Task Day

Then we will create a function that takes List<Task> and return List<TasksGroupedItem> , here is the code

Continue reading

Moving SharePoint documens and save it’s URL , create shorten URLs using SharePoint Document ID

Tags

, , , , , , , , , , , ,


The Problem

 

Suppose yo have this case

1-Important document uploaded to a document library in SharePoint site.

2-You sent the document URL to thousands of your customers

3-For organizing  reason the document is moved inside a folder in the document library or the document library itself is moved to other sub site.

4-The document link is failed to open by your thousands customers !

Also many problems as the above one another example you need to gave users a Shorten URL for a specific page in SharePoint.

Continue reading

Create custom error page for SharePoint event receiver

Tags

, , , , , , ,


Note: you can download the full solution by Click Here

When a custom validation error occur  in SharePoint event receiver from your code and you cancel the event ,  the user will see the error in an ugly .Net default error page !

So in these steps we will view a custom error page that contains a friendly error , our example is to validate the input data in “Title” column and view an error if the “Title” is not equal “Hello” :D

Continue reading

Get tasks assigned to user or to current user groups in SharePoint using CAML query

Tags

, , , , , , ,


The CAML query to get the assigned to and to groups for the current user is

CAML to get assgiend to and your group tasks

CAML to get not completed tasks assigned to and your group

Continue reading

Follow

Get every new post delivered to your Inbox.