Showing posts with label SharePoint 2013.. Show all posts
Showing posts with label SharePoint 2013.. Show all posts

Delete SharePoint list items based on particular view using PowerShell

In this article you can able to see how to delete  SharePoint list items based on the particular view and also having another condition how have to delete items on every Monday, we created a couple of views what type of data have to delete based on item created date.
One view is used to delete SharePoint list items every day and another delete only on Monday.

Note:  by default list item limit is 30 items, we have to modify the view based on the requirement I change to 5000 so every day it will delete only 5000 items to delete.

add-pssnapin microsoft.sharepoint.powershell
$web = get-spweb -identity "http://dotnetsharepoint.com/sites/sharepoint/deleteitems"
$MainList = $web.lists["DeleteListItems"];
$today = (get-date).DayOfWeek
if($today -eq "Monday")
{
$view = $MainList.Views["DeleteMondaylistitems"];
}   
else
{
$view = $MainList.Views["DeleteEverydaylistitems"];
}
$items = $MainList.GetItems($view)
$totalcount = $items.Count
$j = 0;
for($i = $totalcount -1; $i -ge 0; $i--)
{
$deleteitem = $items[$i]
write-host $deleteitem.ID
$deleteitem.Delete()
}

How to add blank value to choice field in SharePoint

As per my requirement I want to show blank value in choice field, but SharePoint won’t take space as a valid option. So we can use ASCII code.
Method1: We can use Unicode character that does not print nothing. I tried with U+205F & it’s working as expected. To use this character please check the below steps.
1.    Navigate to Start -> run -> charmap
  

It will open Character Map Window.
Choose Font: Calibri, Drag down the cursor & select black check the code finally click copy the code

Paste the code in choice field and save.

Now check blank field. 

It’s working as expected.
Method 2: Use ASCII code 0129. It is empty character that SharePoint will accept as a valid option. It will appears empty on dropdown list. Hold down the ALT key and type the number 0129

Create K2 PDF file using PDF Converter in an Advance SmartObject


 First we have to create Advance Smart Object , Check my previous  Article how to create PDF Converter Advance Smart Object.

You can see my Previous article 

How to generate Smart Forms in K2 for SharePoint list


Create Workflow using K2 designer , In the workflow wizard , drag our “PDF Converter” under Advance Smart Object.
It will open “Create PDF from URL” Wizard, Click “Next”


Now we have to configure Outcomes. Add Outcome “Send” & Linked to “Send E-mail”. Click “Next”


We have to provide the input properties for the PDF File.



URL String: http://www.dotnetsharepoint.com/Runtime/Runtime/View/PDFView?Paramemployee=#ID (Runtime URL for the view or list whatever we have to show & map with parameter as shown in below figure.)

Smart Object Name: PDFFile

Smart Object Method: Create

Smart Object File Property: PDF

ID Property Name: ID

File Name:  Employee PDF     (Enter File Name what you want)

Page Size:  A4

Page Orientation: Portrait



Click “Next”, we have to map Data Fields ID to ID Property value as shown in below figure. (Create new ID using String data field.)

Click “Finish”. Now drag “Send E-mail” to send outcome.

It will open Wizard, click “Next”


Now map “PDF Smart Object”  to attachments. As shown in Figure below.


It will open PDF wizard, map “To Integer (Value)” from Inline Function to ID. As shown in figure below.


Finally map “Data Field Id” to “To Integer (Value)” as shown in below figure.


Save & Deploy the workflow.

Run the Form and capture the required details then click the save button.
The E-mail is sent to the recipient with the PDF attached.  

Reference: http://help.k2.com/onlinehelp/k2smartforms/userguide/1.0.4/webframe.html#pdf_converter_service_broker.html
 

Date formula in SharePoint calculated value

In this article I want to show you to get the next 3 years date based on the today’s date, without using Script we can do it simply using the Calculated Value.

We are having a list with name “Date” with Column “Next3Years” and created the calculated value as shown below with settings.

=DATE(YEAR(Today)+3,MONTH(Today),DAY(Today))


We also change X years instead of 3 years based on your requirement.
While Creating new item we can able to see the column as shown below, if we want to change the date we can able to change and save the  item without any issues.
Finally it looks as shown below.




SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

How to keep Select as default value using JQuery in SharePoint

I am having a list name “Required” with two columns “Title” and “Country”, Country is required field I want to keep default value as “Select” in the Drop down and also it has to throw message as required field when the user is trying to save the item  if the default value is “Select”.

Refer the Two JS file from the internet.
jquery-1.11.0.min.js and jquery.SPServices-2014.01.min.js

<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$('select[title^="Country"]').prepend('<option selected ="selected"
value="">Select</option>');
$('select[title^="Country"]').eq(0).selectedIndex = 0;
$('select[title^="Country"]').val('');
});
</script>


Copy the code in Text file and load it in Site Assets.
Refer the script path in the NewForm.aspx page by edit the page and place the content editor refer the script path in the Content Editor.
Finally it will work as shown below.
  




SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Enable link to item other than Title Field in SharePoint

To enable a link to the item and link to the item with edit menu other than the Title Field in a SharePoint.

We are having list name “Hyperlink” having two field Title and Hyper, now I want to add the Link to Hyper Field .
Using SharePoint Designer we can do it easily.
The following steps we have to follow.
Edit the List in SharePoint Designer
Click on “AllItems” View.
Foe my list having only default view, we can implement the same thing for different views also.
Add the Code as per the below screen shot.








Click on Save in Designer
Now we can able to see the Link in SharePoint UI.

OutPut Looks as shown below:





SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.

We crawled people to get results while search, so we created a new content source and given the url
Sps3://dotnetsharepoint.com and started full crawling after 2 mins crawl completed and we can able to see the 1 error message at top level

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. ( HttpStatusCode Unauthorized The request failed with HTTP status 401: Unauthorized.; SearchID


Resolution:
We have to give the permissions for the user profile as shown in the below screen shot.
First we have to identify for which service account having permissions to retrieve people data.
Navigate to your search service application click on it there we can able to see the “Default content access account” with a service account, that account we have to give for our user profile service application
Navigate to the user profile Select the user profile in the top ribbon click on the administrator there we able to see the screen below.
Add the user and check the “Retrieve People Data for Search Crawlers” as shown below.
  
                        


Now crawl the people search again we can able to crawl without any issues.
   

Change the site logo hyperlink URL in SharePoint

Change the site logo hyperlink URL in SharePoint
In SharePoint having the site logo I will indicates the link of the current siteURL, when we want to change the different URL we have to do modify in the master page level.

Locate and identify the currently using master page take a backup before modifying the master page.
Best use of modifying the master page using VS or SharePoint Designer.
Open the master page and search for SPSimpleSiteLink.

This is the exact code we can able to find.
     <SharePoint:SPSimpleSiteLink CssClass="ms-siteicon-a" runat="server" id="onetidProjectPropertyTitleGraphic" >
     <SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=23" runat="server"/>
      </SharePoint:SPSimpleSiteLink>

Replace the code with following changes with your URL.

  <SharePoint:SPLinkButton runat="server" CssClass="ms-siteicon-a"  NavigateUrl="http://dotnetsharepoint.com" id="onetidProjectPropertyTitleGraphic">     <SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=23" runat="server"/>
  </SharePoint:SPLinkButton>

SPLinkButton is the property to navigate the URL.

Save the master page and check the logo hyper link url has changed.


Labels

.Net Interview Questions add custom button in sharepoint using javascript Add custom column property into a PageLayout in SharePoint Add Page Title on their browser's title bar in SharePoint Customly add zip files in blogger Add-SPOSiteCollectionAppCatalog : Must have Manage Web Site permissions or be a tenant admin in order to add or remove sites from the site collection app catalog allow list Advance SmartObject An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL. Angular 2 Angular JS Angularjs Angularjs 1 anonymous users accessing lists and libraries App Permissions for SharePoint 2013 asp.net membership unique email Asp.net TreeView Control asp.net. Attendees in SharePoint Auto refresh list using Content Editor WebPart in SharePoint 2013. Auto Refresh SharePoint list using JavaScript Block and unblock of attachment types in SharePoint Blogger C# Callouts in SharePoint 2013 Cascading Dropdown list in SharePoint change onenote to another location. change SuiteBarLeft in SharePoint 2013 check if userid exists in database c# click node text to expand/collapse in Treeview client object model Close webpart CQWP crate chart using BI site in PPS Create a modern team site collection in SharePoint online Create BI chart in PPS SharePoint 2013 create filter in dashboard designer. create kpi's in dashboard designer create kpi's in SharePoint 2013 dashboard designer Create List Create List In SharePoint Create List using Power Shell Script Create Lookup Field in List using Power Shell Script Create lookup field in List create SharePoint List custom view. create SharePoint List views in List Schema create site collection in site collection in SharePoint using powershell created Date Time calculated field in SharePoint Cross site Collection in SharePoint 2013 Crud Operation in Asp.net Using Stored Procedure Custom MasterPage Approval in SharePoint custom view for survey list Customly add SharePoint List view in Page. delete items in sharepoint using powershell Difference between Angular 1.x & Angular 2 difference between Office 365 and Windows Azure difference between Windows Azure and Office 365 in sharepoint? DifferenceBetween discussion board Display Data in Grid View display radio buttons and choice fields horizontally in SharePoint 2013 Document library DotNet Drag and drop documents in document library in SharePoint dynamically populating values from one list to another list using jquery in sharepoint edit and delete buttons in datagridview Edit Links email notification using Nintex enable anonymous access in SharePoint 2013 enable app catalog sharepoint online site collection powershell Enable appcatalog site collection level using PowerShell based on Input file Enable versions for list and library except the hidden lists using PowerShell Script Error occurred in deployment step 'Recycle IIS Application Pool': Cannot resolve model for the project package Errors&Solutions Export document library in sharepoint using powershell Export particular Group in Term Store Management in SharePoint 2013 Export to Excel first release Flow Flow features free disk space on servers using powershell Friendly URLs and Managed Navigation in SharePoint 2013 get a list of site collection with template in web application using PowerShell Script in SharePoint Get attachments in SharePoint custom list using c# get current list item id sharepoint programmatically Get current url using jquery Get data from SharePoint list using Rest api & Angular JS Get Random Get Random SharePoint items using PowerShell Get Random values from SharePoint list using PowerShell Get url of the last value using jquery Get-SPOSite : The managed path sites/yoursitename is not a managed path in this tenant. Getting Email From User Hide “Edit Links” in left navigation SharePoint 2013 hide button in sharepoint based on permissions Hide column in SharePoint List view hide fields using client side object model Hide list in Quick Launch in SharePoint using PowerShell How to add Custom Tiles to SharePoint site Page. How to add extension files in Search Navigation in SharePoint 2013 How to Add Multiple users Using SharePoint People Picker How to add SharePoint list view in Page using C# How to Approve MasterPage using PowerShell in SharePoint How to bind Multiple users Using SharePoint People Picker how to change indicators on kpi performance how to check if an email address already exists in the database in asp.net how to configure workflow manager platform for SharePoint 2013 how to create calculated value using powershell how to create certificate in SharePoint How to create flow. how to create gantt chart webpart in sharepoint how to create KPI indicators in Dashboard designer How to create moden communication site in SharePoint online How to create Multi selected filter in Dashboard How to create nintex workflow in sharepoint how to create rdlc reports in asp.net How to Display Data Grid View in ASP.net How to enable anonymous access in SharePoint How to find data in datagridview in c# How to get image names from the folder using C# how to get particular list content type id in SharePoint 2013 How to get QueryString value in SharePoint WebPart Programatically how to get the current item id for newly created item using REST API and JQuery how to hide list in sharepoint how to know who created list in sharepoint How to make a Site Collection Read-Only in SharePoint 2010 How to overlay Office 365 shared calendar on SharePoint Site how to pass jquery value to asp.net textbox control How to pass pagename as a browser's title bar in the page how to remove unused Application Pool in SharePoint how to remove zone using powershell script How to send mail to particular group of people using PowerShell how to update modified by and created by using powershell how to uplaod RAR files in blogger import csv data into sharepoint import data using powershell Import group to term store management using SharePoint 2013. InfoPath InfoPath Cascading Dropdown list Insert update delete in datagridview in C# winforms Integration from SharePoint to k2. K2 Smart Forms for SharePoint JavaScript Injection jquery JSON K2 blackpearl K2 Designer K2 Designer Workflow. K2 smartform cascading dropdown list k2 Workflow K2 workflow to send a mail with PDF left navigation Local Term Set in managed meta data Managed meta data navigation in SharePoint 2013 Managed metadata service in SharePoint 2013. Managed Navigation in SharePoint 2013. Managed Promoted Sites. meta data navigation Microsoft Flow New Features New-SPConfigurationDatabase The user does not exist or is not unique NintexWorkFlow Office 365 OneDrive OneNote overwrite existing document in sharepoint using javascript PDF Converter PDF Method in K2 Performance Point Service in SharePoint 2013 PerformancePoint Services Configurtion PerformancePoint Services Configurtion for SharePoint 2013 PerformancePoint Services in SharePoint Server 2013 Popularity trends in SharePoint 2013 Pages populate dropdown list dynamicallyusing jquery Power Power Automate Power Shell Power shell script to get SharePoint site size. PowerApps powershell read xml PowerShell Script PowerShell script to get list of users from SharePoint groups PowerShell Scripts in SharePoint 2013 Powershell to set the masterpage in SharePoint Promoted Links Promoted Sites psconfig.exe quick launch Rdlc reports Readonly Column in SharePoint Editview Realtime DotNet Interview Questions Recent Dotnet interview questions Recent SharePoint interview questions recover deleted OneNote page. OneNote content is missing Regional Settings in SharePoint 2013 Replace New Item text in SharePoint Rest API Schedule PowerShell Script Search in SharePoint 2013 Search navigation in SharePoint 2013 Secure store service SecureStore Services SecureStore Services configuration for SharePoint 2013 self-signed certificate on IIS Server Send email to members of SharePoint Group using PowerShell sharepint2010 sharepoin2010 SharePoint 2013 SharePoint 2010 SharePoint 2013 SharePoint 2013 Dashboard Designer SharePoint 2013 features SharePoint 2013 Interview Questions SharePoint 2013. SharePoint 2013.disable views from user to create SharePoint 2013.Power shell SharePoint 2013.SharePoint 2010 SharePoint 2016 SharePoint Administration SharePoint Alerts and Reminders SharePoint App Configuration SharePoint Apps SharePoint Bulk upload SharePoint Calculated field SharePoint Calendar View sharepoint interview questions SharePoint online interview questions SharePoint online training SharePoint Onprem vs Online SharePoint RealTime Online Training SharePoint2010 SharePoint2013 SharePoint2016 SharePointInterview SharePointOnline SharePointOnline;Restore deleted site;SharePoint 2013 show data in datagridview in C# Simple Insert update Delete Retrieve Clear in asp.net. Site Collection Operations in SharePoint 2013 Site Collection Read-Only in SharePoint 2013 site contents Sorting & Filtering SPO SPSite Site Collection Operation parameters in SharePoint 2013 Step by step to create rdlc report in .Net Store names in text files in C# Sub site Subsite Term store management. The server was unable to save the form at this time. please try again UI New look update created by using client side object model update field values in SharePoint using powershell update items in SharePoint list using client object model update modified by field using client side object model upload zip files in blog use IsNullOrEmpty in PowerShell VirtoSoftware VirtoSofware vitrosoftware WebParts what is Document Set in SharePoint 2010 What is Filter in SharePoint Dashboard what is Limited-access user permission lock down mode feature What is Modern Team site What is Target Audience in SharePoint Who Created Site Using PowerShell Workflow in SharePoint 2013 Workflow management platform in SharePoint 2013 Workflow manager for SharePoint 2013 XSL-Template.