Posts

Reset SQL Server autoincrement ID

 Use the following script to reset the ID to 0 DBCC CHECKIDENT ( TabaleName , RESEED, 0) -------------------------------- Regards Shashika --------------------------------------

Validate SharePoint Special Characters on File Upload name - C#

You cannot use the following characters in a document name when you upload the document in SharePoint Site o    Number sign (#) o    Tilde (~)   o    Percent (%) o    Ampersand (&) o    Asterisk (*) o    Braces ({ }) o    Backslash (\) o    Colon (:) o    Angle brackets (< >) o    Question mark (?) o    Slash (/) o    Plus sign (+) o    Pipe (|) o    Quotation mark (") Here is the method to check that the documents contains any special characters     protected bool IsValidFilename(string fileName){               string pattern = "[\\~#%&*{}/:<>?|\"-]";               try               {                   if (...

How to programmatically send an email in SharePoint

Image
Send Email programmatically in SharePoint Using Customize Email Body Create a New List is SharePoint  SendEmail.cs  - Get The Email Body According to the Email Title  public class SendEmail     {         string spSitestring = SPContext.Current.Site.Url;         Logger log = new Logger();      public EmailBodyEntity getEmailBodyLinkTitle(string title)         {             try             {                 using (SPSite spSite = new SPSite(spSitestring))                 {              ...

Add Sign in as Different User to SharePoint 2013

Image
This “Sign in as Different User” menu item is very useful when testing applications, but it can lead to problems especially when opening documents, say in Microsoft Word. So, it may be for these reasons that the option has been removed in SharePoint 2013.                                  Steps Locate the file \15\TEMPLATE\CONTROLTEMPLATES\Welcome.ascx and open in a text editor. Add the following element before the existing element with the id of “ID_RequestAccess”: <SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"   Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"   Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"   MenuGroupId="100"   Sequence="100"   UseShortId="true"   /> Save the file.

Create folders and subfolders in Sharepoint 2013 Document Library - C#

Image
Create a single Folder private void CreateSingleFolder()         {             SPSecurity.RunWithElevatedPrivileges(delegate()                {                    using (SPSite site = new SPSite(SPContext.Current.Web.Url))                    {                        using (SPWeb web = site.OpenWeb())                        {                            try                            {                                SPDocumentLibrary documentLib = web....

SSRS IIF Conditions

Image
IIF Condition with two Field Values  Problem: Getting a string output according to the two DataFields Example : DataField 1            DataField2                   Output (IsComplete)         (IsApproved)     True                      True               =       "Completed"          False                      False              =       "Pending"     True                      False              =       "Rejected" Solution: Use the expression as: =iif((Fields!IsCompleted.Value = "True") AND (Fields!IsApproved.Value ...

Add / Update Tasks programmatically into the taskList in sharepoint - c#

Image
Add Task Method public bool AddTask(int ID, string RequestNumber, SPFieldUrlValue Link, SPFieldUserValueCollection AssignedTo) {  try             {                 SPSecurity.RunWithElevatedPrivileges(delegate()                {                    using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb())                    {                        oWebsite.AllowUnsafeUpdates = true;                        SPListItemCollection SPLstItCol = spWeb.Lists[" YourTaskName "].Items;                          if (ID == 0)                 ...