Friday, May 31, 2013

SharePoint 2010 and LiveLink Integration - Information

SharePoint Foundation 2010 supports authentication methods that were included in previous versions and also introduces token-based authentication that is based on Security Assertion Markup Language (SAML) as an option. The following table lists the supported authentication methods.


Application that support Windows integrated authentication (NTLM or Kerberos, as described in http://spnego.sourceforge.net/



SharePoint and LiveLink Integration: Part 1How to use WCF Livelink web services to create a quasi single sign on or login with cookie equivalent of lapiUnderstanding WS-Federation


Thursday, May 30, 2013

SharePoint 2010 : Context Menu Duplicating Menu Items:

I haven’t find any solutions other than the steps below, which can fix the issues that related to context menu duplicating items:

1.       Locate the folder in the production server : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033.
2.       Locate the “core.js” and “core.debug.js” file and make a backup core.js and core.debug.js files [Important: Do not edit the existing core.js file].
3.       Edit the .js file and search the string for each menu item, if founds comment  the function (/*…*/).
4.       Reset IIS.




I have tested in my VMware and you can see the changes before and after, the “Alert Me” button is not showing up now:









And the result goes as below:



there is one drawback – the change made will affect all the web applications that we have on the server.  Also, it is in production server, so we be in very CAREFUL. 

SharePoint 2010 - Refresh the parent page using Server side API !

1.  Add the following code in elements.xml 

function openSitePropertyDialog(url) { 
       var dialogOptions = SP.UI.$create_DialogOptions(); 
       dialogOptions.width = 800; 
       dialogOptions.height = 400; 
       dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, sitePropertiesDialogCallback); 
       commonModalDialogOpen( 
               url, 
               dialogOptions, 
               sitePropertiesDialogCallback, 
               null); 
   } 
   function sitePropertiesDialogCallback(dialogResult, returnValue) { 
       if (returnValue != null) { 
           var notificationId = SP.UI.Notify.addNotification(returnValue, false); 
       } 
       SP.UI.ModalDialog.RefreshPage(dialogResult); 
       //refreshUpdatePanelOnDialogCallback(dialogResult); 
   } 
   function refreshUpdatePanelOnDialogCallback(dialogResult) { 
       if (dialogResult == SP.UI.DialogResult.OK) { 
           __doPostBack(<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(SitePropertiesUpdatePanel.ClientID),Response.Output);%>); 
       } 
   } 

2.  In code-behind do the following

if (!Page.IsValid) 
           { 
               return; 
           } 
 
           //Get propertyName and propertyValue to add 
           string propertyName = NameInputFormTextBox.Text.Trim(); 
           string propertyValue = ValueInputFormTextBox.Text.Trim(); 
 
 
           if (String.IsNullOrEmpty(propertyName)) 
           { 
               NameErrorLabel.Text = "Site property name cannot be empty."; 
               return; 
           } 
 
 
           try 
           { 
               if (Web.GetProperty(propertyName) != null) 
               { 
                   NameErrorLabel.Text = "Site property name already exists."; 
                   return; 
               } 
 
 
               Web.AddProperty(propertyName, propertyValue); 
               Web.Update(); 
           } 
           catch (Exception ex) 
           { 
               throw new SPException(ex.Message); 
           } 
 
 
           //Refresh the page when the dialog is closed by write JS directly to the 
           //http Response object that will close the dialog          
           if (SPContext.Current.IsPopUI) 
           { 
               Response.Clear(); 
               Response.Write(String.Format(@"<script language=""javascript"" type=""text/javascript""> 
 
               window.frameElement.commonModalDialogClose(1""{0}"");</script>", "Site property is successfully added.")); 
               Response.End(); 
           } 
           else 
           { 
               SPUtility.Redirect(strSource, SPRedirectFlags.UseSource, this.Context); 
           }           
Click here to download code from MSDN

SharePoint 2010 - Add Popup In SharePoint 2010

Create a new element and copy the following script into your element.xml file.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction ScriptSrc="~site/Scripts/main.js" Location="ScriptLink" Sequence="100">
</CustomAction>
<CustomAction
 Id="CreateDS"
 RegistrationType="ContentType"
 RegistrationId="0x0101"
 Location="EditControlBlock"
 Title="Create Data Set - Beta V 1.0"
 ImageUrl="/_layouts/images/FOLDER16.GIF"
 Sequence="0"
 Rights ="EditListItems">
<UrlAction Url="javascript:showDSWindow();
var statusId;
function notifyMe(msg)
{
var statusId = SP.UI.Status.addStatus(msg);         
visibleStatusIds.push(statusId); 
enableRemoveStatusButton(); 
RefreshCommandUI();
}
 
function RemoveStatus() {
SP.UI.Status.removeStatus(this.statusId);
}
function demoCallback(dialogResult, returnValue)
{    
 /*alert(returnValue);
 this.statusId = SP.UI.Status.addStatus('DataSet Created','New Data Set Created.',true);
 SP.UI.Status.setStatusPriColor(this.statusId, 'Green');
 setTimeout(RemoveStatus, 1000);*/
 SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}

function CreateDSWindow()
{
var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var myItems = '';
var k;
var enable = true;
if (items.length=='0'){alert('You must select at least one document to continue.');return;}
for (k in items)
{
myItems += '|' + items[k].id;
if (items[k].fsObjType != 0)
enable = false;
}
if (!enable) {alert(' The files will NOT be moved to new Document Set, unselect the DataSet/Folder ...');return;}
var options = {              
url: '{SiteUrl}/_layouts/CreateDocumentSet/ChooseDS.aspx?ListId={ListId}&amp;items=' + myItems + '&amp;source=' + SP.ListOperation.Selection.getSelectedList(),
tite: 'Move Documents - Stellar Demo V 1.0',
allowMaximize: false,
showClose: true,
width: 500,
height: 380,
dialogReturnValueCallback: demoCallback };
SP.UI.ModalDialog.showModalDialog(options);}

function showDSWindow()
{
CreateDSWindow();
}   
" />
</CustomAction>
</Elements>

2. Create an ASPX file called ChooseDS.aspx