Pages

Friday, March 22, 2019

Shrepoint Page library not created After activated Publishing feature. Unable to create any publishing pages

I have enabled SharePoint server publishing feature in the site, which is a site collection as well. But unfortunately the Pages library list is not appearing and i am unable to create any publishing pages.
Is there a way to solve this. I tried deactivating and activating via manually still i didnt get solution.

Solution:

Kindly find in the powershell script then deactivating and activating using powershell commands.
Finally, It will appear publishing feature and page library lists.

SharePoint Server:
Disable-SPFeature identity 'publishingSite' -URL http://server/ -force
Disable-SPFeature identity 'PublishingResources' -URL http://server/ -force
Disable-SPFeature identity 'Publishing' -URL http://server/ -force
Disable-SPFeature identity 'PublishingLayouts' -URL http://server/ -force
Disable-SPFeature identity 'publishingweb' -URL http://server/ -force

Enable-SPFeature identity 'publishingSite' -URL http://server/ -force
Enable-SPFeature identity 'PublishingResources' -URL http://server/ -force
Enable-SPFeature identity 'Publishing' -URL http://server/ -force
Enable-SPFeature identity 'PublishingLayouts' -URL http://server/ -force
Enable-SPFeature identity 'publishingweb' -URL http://server/ -force
SharePoint Online/PnP-PowerShell:
Disable-SPOFeature Identity "F6924D36-2FA8-4f0b-B16D-06B7250180FA" -Scope Site
Disable-SPOFeature Identity "AEBC918D-B20F-4a11-A1DB-9ED84D79C87E" -Scope Site
Disable-SPOFeature Identity "22A9EF51-737B-4ff2-9346-694633FE4416" -Scope Web
Disable-SPOFeature Identity "D3F51BE2-38A8-4e44-BA84-940D35BE1566" -Scope Site
Disable-SPOFeature Identity "94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB" -Scope Web

Enable-SPOFeature Identity "F6924D36-2FA8-4f0b-B16D-06B7250180FA" -Scope Site
Enable-SPOFeature Identity "AEBC918D-B20F-4a11-A1DB-9ED84D79C87E" -Scope Site
Enable-SPOFeature Identity "22A9EF51-737B-4ff2-9346-694633FE4416" -Scope Web
Enable-SPOFeature Identity "D3F51BE2-38A8-4e44-BA84-940D35BE1566" -Scope Site
Enable-SPOFeature Identity "94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB" -Scope Web

Friday, February 1, 2019

Sharepoint JSOM client object model code to retrieve other list item in Nintex Form

When using the SharePoint JavaScript client object model, your code needs to be broken up into two parts: the first part specifies what you want to get, and involves you loading queries and commands into an SPClientContext object; the second part lets you manipulate the results of the query to SharePoint, and runs as an asynchronous callback of the query execution.
  1. Create your context, specify which lists you want to access, etc.
  2. Run clientContext.executeQueryAsync() (where clientContext is an SP.ClientContextobject), and pass in delegate functions to run on success or failure
  3. In your "onSuccess" delegate function, you can work with the results of the commands you loaded up in step 1



function FormLoading()
{
console.log('Inside Jcode Form Loading Calls');
NWF$("#" + JSLeaveType).change(function()
{

EmpLeaveBalance();
});
}

function  EmployeeLeaveBalance()
{
try
{
NWF$("#" + JSLeaveBalance).val("");
var clientContext = SP.ClientContext.get_current(); 
var web = clientContext.get_web(); 

var oList = clientContext.get_web().get_lists().getByTitle("LeaveSBalanceS");

var newCRUsername = varCRUsername.replace('downlevelTextBox','upLevelDiv');
var varCRUsernamevalue= NWF$('#' + newCRUsername).find('span.ms-entity-resolved').attr('title');
var lists = new SPAPI_Lists('');
var userprofiles= new SPAPI_UserProfile('');
var currentUserProfile = getUserProfileInfo(userprofiles,varCRUsernamevalue); 
var userFullName = getFullName(currentUserProfile);
//alert('UserFullName  '+userFullName);
//var varCurrentUser = clientContext.get_web().currentUser();
//var accountname = currentUser.get_title();
//console.log("accountname --> " + accountname);
var camlQuery = new SP.CamlQuery();
/* Use a CAML query to filter your results */
camlQuery.set_viewXml( +userFullName+ );

//camlQuery.set_viewXml('' + userFullName + '' + (new Date()).getFullYear() + '');
/* get the list item collection from the list */
        var oListItems = oList.getItems(camlQuery);
/* tell SharePoint to load the list items */
clientContext.load(oListItems);
  
//var LeaveType=NWF$("#" + JSLeaveType).val();   
var LeaveType=NWF$("#" + JSLeaveType + ' option:selected').text(); //Nintex form control is lookup field then get selected text
//clientContext.load(ListItem,'Include(AnnualLeave)','Include(MedicalLeave)'); 
/* execute the query to get the loaded items */

    clientContext.executeQueryAsync(
        /* onSuccess Function */
        Function.createDelegate(this, function () {
            /* 
            now that the query has run, you can get an enumerator 
            from your list item collection 
            */
            var arrayListEnum = oListItems.getEnumerator();
            var ids = [];
            while (arrayListEnum.moveNext()) {
console.log("New Inside While array loop");
//console.log(arrayListItem.get_current());
var listItem = arrayListEnum.get_current();
console.log(listItem.get_item('Title'));
console.log(listItem.get_item('AnnualLeave'));
console.log(listItem.get_item('MedicalLeave'));
//var varLeaveTypeName = NWF.RuntimeFunctions.parseLookup(NWF$('#'+JSLeaveType).val(),true); // Not working
var varLeaveTypeName =NWF$('#'+ JSLeaveType + ' option:selected').text();
console.log("varLeaveTypeName with Space  "+varLeaveTypeName);
varLeaveTypeName=varLeaveTypeName.replace(/\s+/g, ''); //Remove Space Javascript varaible
console.log("varLeaveTypeName without space "+varLeaveTypeName);
var varLeaveBalance = listItem.get_item(varLeaveTypeName);
console.log(varLeaveBalance);
            }
//console.log("Outside While array loop");
            
        }),
        /*onFailure Function*/
        Function.createDelegate(this, function (sender, args) {
            alert("Whoops: " + args.get_message() + " " + args.get_stackTrace());
        })
);
 }
catch(e)
{
alert("EmployeeLeaveBalance ERROR is " + e);
}
 }


Tuesday, January 15, 2019

Recovering the suspected SharePoint 2013 Config database

Issue:

Central Administrator site not accessible.



Open SQL Server -- New Query, run these command to repair the SharePoint config database.




— Use the Master database 
Use Master

— Verify that database has issues 
EXEC sp_resetstatus 'SharePoint_Config'

— Put the database in emergency mode 
ALTER DATABASE SharePoint_Config SET EMERGENCY 
DBCC checkdb('SharePoint_Config')

— Set the database in single user mode 
ALTER DATABASE SharePoint_Config SET SINGLE_USER WITH ROLLBACK IMMEDIATE

— Repair the database with data loss 
DBCC CheckDB ('SharePoint_Config', REPAIR_ALLOW_DATA_LOSS)

— Set the database in multi-user mode 
ALTER DATABASE SharePoint_Config SET MULTI_USER

— Verify that database is reset 
EXEC sp_resetstatus 'SharePoint_Config'

Friday, January 11, 2019

Sharepoint Online - Quick Edit supports JS Link and Client Side Rendering

The sharepoint online list quick edit (Data Sheet View) would support Client Side Rendering Code (CSR).

when I renamed a file to become “kar.txt” it turns the background green &  text white colour tag.   This could be leveraged to give end users real-time feedback on the values entered.   Unlike a JQuery page load event which only triggers once, this triggers per row as values are changed.

 Upload JS file to Site Asset library and Provide in the following

~site/SiteAssets/CSSQEdit.js