Thursday, July 19, 2018

WE CAN’T DO THAT FOR YOU BECAUSE THE FILE IS NO LONGER CHECKED OUT OR HAS BEEN DELETED IN SHAREPOINT DESIGNER

SCENARIO

In SharePoint Designer, When I tried to “Check In” a file inside, I got the below error:

WE CAN’T DO THAT FOR YOU BECAUSE THE FILE IS NO LONGER CHECKED OUT OR HAS BEEN DELETED

We can't do that for you because the file is no longer checked out or has been deleted
I already have tried to
  • Close Share Point Designer and restart it again,
  • Close SPD then clear cache from the following folder:
    • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
    • %USERPROFILE%\AppData\Roaming\Microsoft\Web Server Extensions\Cache
Unfortunately, the “We can’t do that for you because the file is no longer checked out or has been deleted” still persists.

CAUSE

This problem might occur in case, the file title contains disallowed characters like “/” as shown below:
The file title contains disallowed characters in SharePoint Designer

SOLUTION

  • Right-click on the affected file >  Select “Edit file in advanced mode“.
Edit file in advanced mode in SharePoint Designer
  • Right-click again on the affected file > Select “properties“.
Open File Properties In SharePoint Designer
  • The properties page should be shown.
The file title contains disallowed characters in SharePoint Designer
  • Remove URL > Change the title to an appropriate name by avoiding using the disallowed characters.
master-page-properties-change-title-SharePoint-designer
The file should be now checked in properly.

Reference of this POST

Tuesday, July 10, 2018

REST API Compare Date Field

add following "toISOString()" that will allow you to check Date is >,<,>=,<=,!=

var today = new Date();
...$filter=StartDate ge  + today.toISOString() + and ...

Calculate Day in SharePoint

LastAction = '7 Apr 2018'
Created = '1 Apr 2018'

=DATEVALUE(TEXT(LastAction,"dd/mm/yyyy"))-DATEVALUE(TEXT(Created,"dd/mm/yyyy"))

OUTPUT
6

Tuesday, June 19, 2018

Remove duplicate through JQuery





 
    test1
     
 
 
    test2
     
 
 
    test1
     
 
 
    test2
     
 




var seen = {};
$('table tr').each(function() {
  var txt = $(this).text();
  if (seen[txt])
    $(this).remove();
  else
    seen[txt] = true;
});


Monday, April 9, 2018

Display User Profile Picture in SharePoint 2013 Site

Get the URL from the current user's profile via REST, the image tag used to display when the src is updated:
/_api/sp.userprofiles.peoplemanager/getmyproperties endpoint which returns PersonalUrl property, user profile picture could be requested via _layouts/15/userphoto.aspx?size=&accountname= page, where

size - could be set to S/M/L which stands for Small/Medium/Large image size
accountname - user account name

example : [src='/_layouts/15/userphoto.aspx?size=L&accountname=username@contoso.com' ]

Thursday, March 29, 2018

Only Numeric with Single Decimal - JavaScript


//Keypress event on a Class
$('.onlyNumeric').on('keypress', function(e) {
return isNumber(event, this);
   });

//Function to validate Number, Decimal and Negative sign
function isNumber(evt, element) {
        var charCode = (evt.which) ? evt.which : event.keyCode

        if (
            (charCode != 46 || $(element).val().indexOf('.') != -1) &&  
            (charCode < 48 || charCode > 57))
            return false;

        return true;
    }    

Friday, March 23, 2018

Send Email with Powershell

Example1
# You must have Site Collection Access to use following process.

function SendEmail($requestor)
            {
                try
                {
                    $emailTo = $requestor
                    $emailSubject = "Test"
                    $emailBody = "Hi,This is a Test Email."

                    $emailUser = "yourEmail@myDomain.com"
                    $emailPwd = "pass@123"
                    
                    Send-PnPMail -To $emailTo -Subject $emailSubject -Body $emailBody -From $emailUser -Password $emailPwd
                    Write-output "Email sent: Successful!"
                }
                catch
                {
                    #known suppression
                    Write-output "Email sent: Failed! Reason:"$_.Exception.Message.ToString()
                }
            }
SendEmail("myEmail@myDomain.com")


Example 2
# Relay emailID example.

$smtp = new-object Net.Mail.SmtpClient("relay-mailbox.com") #Dns name or IP

$smtp.Send("fromEmail@myDomain.com", "toEmail@myDomain.com", "PowerShell Email", "This is a email from powershell")