Wednesday, May 2, 2018

SharePoint Designer issue when creating or opening workflow

Lately I've notice an issue with SharePoint Designer while working with workflows.
So here's what the issue scenario is.
Scenario 1:

  • Open SharePoint Designer and then open any site (SharePoint online site)
  • Create a workflow for any document library or list
  • Below error shows up. 


"Server side activities have been updated you need to restart SharePoint designer."


Scenario 2:

  • Open SharePoint Designer and then open any site (SharePoint online site)
  • Open an existing workflow
  • An error shows up same like above scenario 1.
I've referred many articles online and unfortunately I didn't find any concrete solution which worked for me. So here's what I did and it resolved the issue.

Clear cache from below locations
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %APPDATA%\Microsoft\SharePoint Designer\ProxyAssemblyCache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
  • C:\Users\\AppData\Roaming\Microsoft\SharePoint Designer
·        

Now uninstall SharePoint Designer
Reboot and then re-install in below order.


Order of installation


SharePoint Designer 64-bit (sharepointdesigner2013_64bit.exe) File Version: 15.0.4420.1017

SharePoint Designer Service Pack 1 (spdsp2013-kb2817441-fullfile-x64-en-us.exe) File Version: 15.0.4569.1506

Security Update for Microsoft SharePoint Designer 2013 (spd2013-kb2863836-fullfile-x64-glb.exe) File Version: 15.0.4615.1001

Update for Microsoft SharePoint Designer 2013 (spd2013-kb3114337-fullfile-x64-glb.exe) File Version: 15.0.4787.1000

Update for Microsoft SharePoint Designer 2013 (spd2013-kb3114721-fullfile-x64-glb.exe) File Version: 15.0.4849.1000

Monday, July 26, 2010

Using Ajax in SharePoint Application Pages

Hello Readers,

In this post, I would like to discuss how to integrate Ajax with custom application pages in SharePoint.

This article assumes that you are using .NET Framework 3.5. You need not install anything because .NET Framework 3.5 supports Ajax and it includes all Ajax related stuff like script manager, update panel, etc.

Paste below line in content place holder with ID “Main”.

<asp:ScriptManager ID="ScriptManager1" runat="server" ></asp:ScriptManager>

This will add script manager to the application page and manages ASP.NET Ajax script libraries and script files, partial-page rendering, and client proxy class generation for Web and application services.

Then add the following block next to end of script manager.

<asp:UpdateProgress runat="server" id="PageUpdateProgress">
    <ProgressTemplate>
    <div><asp:Image ID="Image1" runat="server" ImageAlign="Left" ImageUrl="/_layouts/IMAGES/ProgressImage.gif" /><asp:Label ID="lblProgressText" runat="server" Text="Please wait while your changes are processed" Width="500" Font-Size="Medium" Font-Underline="true" Font-Bold="true" ForeColor="Green" ></asp:Label></div>
     <div id="progressBackgroundFilter">&nbsp;</div>
    </ProgressTemplate>
</asp:UpdateProgress>

UpdateProgress control starts working when asynchronous operations are in progress and provides visual feedback in the browser when the contents of one or more UpdatePanel controls are updated. I used a animated image for showing on screen while asynchronous operations are in progress.

Then add below lines

<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>

//Put your controls here

</ContentTemplate>

</asp:UpdatePanel>

UpdatePanel enables sections of a page to be partially rendered without a postback.

With this you are almost done Ajaxfying your application page. Only thing left on this is, you need to register async post back control in code behind file of your aspx page.

You can do this by adding the following line in page load event of the aspx page.

ScriptManager1.RegisterAsyncPostBackControl(btnCreate);

In the above line btnCreate is the control ID I used for actual operations has to be done in post back.

With this you are done.

Few things you need to take care are:

Some controls may not support post back scenarios during partial page rendering. For example, File Upload control.

If you are using file upload control in your aspx page, the file must be uploaded by using a control that is a post back trigger object for the panel. Update Panels are used to update selected regions of a page instead of updating the whole path with a post back.

Useful links on this:

Using the AJAX Update Panel in SharePoint

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

Script Manager Class

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx

Using the FileUpload Control with the UpdatePanel Control

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx

Regards,

Sudhakar Bulli

Sunday, April 4, 2010

Understanding the difference between “IS NULL” and “= NULL”

When a variable is created in SQL with the declare statement it is created with no data and stored in the variable table (vtable) inside SQLs memory space. The vtable contains the name and memory address of the variable. However, when the variable is created no memory address is allocated to the variable and thus the variable is not defined in terms of memory.
When you SET the variable it is allotted a memory address and the initial data is stored in that address. When you SET the value again the data in the memory address pointed to by the variable is then changed to the new value.
Now for the difference and why each behaves the way it does.
“= NULL”
“= NULL” is an expression of value. Meaning, if the variable has been set and memory created for the storage of data it has a value. A variable can in fact be set to NULL which means the data value of the objects is unknown. If the value has been set like so:
DECLARE @val CHAR(4)
SET @val = NULL
You have explicitly set the value of the data to unknown and so when you do:
If @val = NULL
It will evaluate as a true expression.
But if I do:
DECLARE @val CHAR(4)
If @val =  NULL
It will evaluate to false.
The reason for this is the fact that I am checking for NULL as the value of @val. Since I have not SET the value of @val no memory address has been assigned and therefore no value exists for @val.
Note: See section on SET ANSI_NULLS (ON|OFF) due to differences in SQL 7 and 2000 defaults that cause examples to not work. This is based on SQL 7.
“IS NULL”
Now “IS NULL” is a little trickier and is the preferred method for evaluating the condition of a variable being NULL. When you use the “IS NULL” clause, it checks both the address of the variable and the data within the variable as being unknown. So if I for example do:
DECLARE @val CHAR(4)
If @val IS NULL
            PRINT ‘TRUE’
ELSE
            PRINT ‘FALSE’
SET @val = NULL
If @val IS NULL
            PRINT ‘TRUE’
ELSE
            PRINT ‘FALSE’
Both outputs will be TRUE. The reason is in the first @val IS NULL I have only declared the variable and no address space for data has been set which “IS NULL” check for. And in the second the value has been explicitly set to NULL which “IS NULL” checks also.
SET ANSI_NULLS (ON|OFF)
Now let me throw a kink in the works. In the previous examples you see that = NULL will work as long as the value is explicitly set. However, when you SET ANSI_NULLS ON things will behave a little different.
Ex.
DECLARE @val CHAR(4)
SET @val = NULL
SET ANSI_NULLS ON
If @val =NULL
            PRINT ‘TRUE’
ELSE
            PRINT ‘FALSE’
SET ANSI_NULLS OFF
If @val =NULL
            PRINT ‘TRUE’
ELSE
            PRINT ‘FALSE’
You will note the first time you run the = NULL statement after doing SET ANSI_NULLS ON you get a FALSE and after setting OFF you get a TRUE. The reason is as follows.
Excerpt from SQL BOL article “SET ANSI_NULLS”
The SQL-92 standard requires that an equals (=) or not equal to (<>) comparison against a null value evaluates to FALSE. When SET ANSI_NULLS is ON, a SELECT statement using WHERE column_name = NULL returns zero rows even if there are null values in column_name. A SELECT statement using WHERE column_name <> NULL returns zero rows even if there are nonnull values in column_name.
When SET ANSI_NULLS is OFF, the Equals (=) and Not Equal To (<>) comparison operators do not follow the SQL-92 standard. A SELECT statement using WHERE column_name = NULL returns the rows with null values in column_name. A SELECT statement using WHERE column_name <> NULL returns the rows with nonnull values in the column. In addition, a SELECT statement using WHERE column_name <> XYZ_value returns all rows that are not XYZ value and that are not NULL.
End Excerpt
So as defined by SQL92, “= NULL” should always evaluate false. So even setting the value explicitly means you will never meet the = NULL if condition and your code may not work as intended. The biggest reason where = NULL will shoot you in the foot is this, SQL 7 when shipped and installed is defaulted to ANSI_NULL OFF but SQL 2000 is defaulted to ANSI_NULL ON. Of course you can alter this several ways but if you upgraded a database from 7 to 2000 and found the = NULL worked only when you set if explicitly when you roll out a default 2000 server your code now breaks and can cause data issues.
Yet another reason to use IS NULL instead as under SQL 92 guidelines it is still going to evaluate to TRUE and thus your code is safer for upgrading the server.
Summary
If summary unless you need to check that the value of a variable was set to equal NULL and you have set ANSI_NULLS ON, then always use the “IS NULL” clause  to validate if a variable is NULL. By using = NULL instead you can cause yourself a lot of headaches in trying to troubleshoot issues that may arise from it, now or unexpectedly in the future.

Wednesday, March 31, 2010

Exception Logging in SharePoint

There are several methods of logging exceptions in SharePoint such as in SharePoint Logs, Event Viewer, etc. In this post, I would like to discuss logging SharePoint exceptions in Logs folder of SharePoint 12 hive programmatically.

Add Microsoft.Office.Server dll as a reference to your project

Add following line in using section

using Microsoft.Office.Server.Diagnostics;

 

PortalLog.LogString("Source:", “YourApplicationName”, “TypeofError”, “ActualExceptionMessageGoesHere”);

 

regards,

Sudhakar Bulli

Thursday, March 25, 2010

Using People Editor Control in SharePoint

People Editor or People Picker is SharePoint control which represents a PeopleEditor object in a PeoplePicker control. Would like to discuss the usage of this control in a SharePoint custom page as well as programming with this control.

First you need to add Microsoft.SharePoint reference to your project and then add following line in register tag section

<%@ Register TagPrefix="wss" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Once we add a reference to the namespace containing People Editor control, it is ready to use. It can be added as below

<wss:PeopleEditor id="peopleEditorTest" runat="server" MultiSelect="false" ValidatorEnabled="true" />

I am not discussing all the attributes/members of the control which can be read from the msdn article http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.peopleeditor.aspx

Now let us see how this can be used through SharePoint object model. Add an object in the cs page to work with the control

using Microsoft.SharePoint.WebControls;

protected PeopleEditor peopleEditorTest;

Below code can be used wherever you want to save the value of the people editor control such as updating list item, etc

string strValue = string.Empty;

if (peopleEditorTest!= null)
  {
    if (!string.IsNullOrEmpty(peopleEditorTest.CommaSeparatedAccounts))

strValue = peopleEditorTest.CommaSeparatedAccounts;
}

You can get other values such as user name, description, etc by type casting it to Picker Entity.

PickerEntity pe = (PickerEntity)peopleEditorTest.Entities[0]; //gets first user in list
string username = pe.Description;

That’s it.

 

Regards,

Sudhakar Bulli.