Wednesday, May 27, 2015

SharePoint Checked-out file details in a specific Document library

SharePoint Checked-out files details in a specific Document library


  SPDocumentLibrary docLibrary = (SPDocumentLibrary)web.Lists.TryGetList("Admin");
                    foreach (SPCheckedOutFile coFile in docLibrary.CheckedOutFiles)
                    {
                        Console.WriteLine(coFile.LeafName);
                        Console.WriteLine(coFile.DirName);
                        Console.WriteLine(coFile.CheckedOutByName);
                        Console.WriteLine("\n");
                    }

Thursday, May 21, 2015

Modern Dialogue in ASPX or SharePoint forms

Modern Dialogue in ASPX or SharePoint forms


<p><a href="javascript:portal_openModalDialog();">My link</a></p>
<script>
    function portal_openModalDialog() {
        var options = {    
            url: SP.Utilities.Utility.getLayoutsPageUrl('#' + location.href),    
            title: 'Edit web info',    
            allowMaximize: false,    
            showClose: true,    
            width: 800,    
            height: 330,    
            dialogReturnValueCallback: Function.createDelegate(null, 
                function (result, returnValue) {        
                    if (result == SP.UI.DialogResult.OK) {            
                        if (returnValue == null) {                
                            SP.UI.Notify.addNotification('Operation successful');                
                            SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);            
                        }            
                        else {                
                            location.href = returnValue;            
                        }        
                    }    
                }
            )
        }; 
        SP.UI.ModalDialog.showModalDialog(options);
    }
</script>