Posted on Leave a comment

2013 – How to Reference a Custom .CSS File on the Master Page in Foundation with SPD – SharePoint Stack Exchange

2

Okay, I finally got this to work. I’m going to post a detailed step-by-step way I did this. The problems I’ve been having seem to mostly be related to not understanding a lot of the terminology/locations of things. Hopefully this will help anyone else still new to everything.

I opened the main site in SharePoint Designer 2013, then opened the Master Page Gallery. I then created a folder called “Style Library” within the gallery.

enter image description here

I then opened notepad a wrote some CSS in there. To test, I made all p tags yellow. I then saved the file as CustomStyle.css, and uploaded it into the new Style Library folder I had just made (you can just drag and drop it).

I then opened the seattle.master page (after creating a backup by copy/pasting) and inserted the following:

<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server" />    
<SharePoint:CssRegistration Name="/_catalogs/masterpage/Style Library/CustomStyle.css" runat="server" after="corev15.css"/>

The first line in the above code snippet already exists in the master file, the second line should be added below it.

Just save and refresh your SharePoint page. It worked for me in 2013 Foundation.

Source: 2013 – How to Reference a Custom .CSS File on the Master Page in Foundation with SPD – SharePoint Stack Exchange

Posted on Leave a comment

Prevent SharePoint list item deletion – Stack Overflow

How can I prevent users from deleting sharepoint task list item? Should i override the ItemDeleting event or is there any other site level options available to achieve the same?

You could also set up a custom permission level out of the box.

  1. Navigate to your Site Collection (if you’re in a subsite, you can go to Site Actions -> Site Settings -> Go to top level site settings)
  2. Site Actions -> Site Settings -> Advanced permissions
  3. Click Settings -> Permission Levels
  4. Click Add a permission level

I would recommend using the existing “Contribute” permission level as a guide and just uncheck the “Delete Items” list permission. Then, you can give your users that permission to the list.

You can use List Item Event Receiver, ItemDeleting method:

public override void ItemDeleting(SPItemEventProperties properties)
{
    properties.ErrorMessage = "User don't have permission";
    properties.Cancel = true;
}

Source: Prevent SharePoint list item deletion – Stack Overflow

Posted on Leave a comment

SharePoint Online: Filter items created by user or group of user in custom list – Anh Vo

In this article, I will show you How to create a query to filter items that were created by user or group of user on a SharePoint Custom List.

*Requirements: SharePoint Site with a Custom List, SharePoint Designer, CAML (optional)

Normally, if we want to filter items on a list, we will go to List Setting → Modify the target View → Add filter rules. However, these rules are so limited – we can only use [Me] and [Today] to filter items that were created by ourselves or that were created today. How about when we need to filter items that belong to a group of users? The basic filter rules won’t let you to achieve this. Fortunately, with the help of SharePoint Designer, we can easily unlock this feature.

Let’s start!

Step 1 – Open SharePoint Designer and load your SharePoint site that has the list on it. Select your list. Then, on the right panel, you will see Views. Select the one you want to have filter rules on it.

Capture

Step 2 – Modify the query code. After you click on the view, a page of code will be shown up. If you cannot edit it, press the Advanced Mode button on the Toolbar. Search for <Query> tag and start editing (you should have set basic query rules before-hand).

Capture1

Step 3 – Insert the code. Now based on your need, you will edit the query code as you wish. Our target is to Filter items that belong to a group of user. The key is to add the following syntax:

<Membership Type = “CurrentUserGroups”>
<FieldRef Name = “The field that have the group name“>
</Membership Type>

You should study a little bit about CAML query syntax as this will help you to easily build complex query.

That’s it! Now, your list will be able to filter items that were created by you or belong to group that you are a member of.

I hope this tutorial will help you to achieve your goals.

—————————————————————————————————————————————–

*Sample Query Syntax – This one will first group the items based on Priority and then on Title. It will order the items according to the most recent Due Date and then ID number. Finally, the filter rules are: Filter items that has status Open, that were Created by user or it is CC to the user – the CC field will contain the user name or the group that the user belongs to.

<Query>
<GroupBy Collapse=”TRUE” GroupLimit=”30″>
<FieldRef Name=”Priority”/>
<FieldRef Name=”LinkTitle”/>
</GroupBy>
<OrderBy>
<FieldRef Name=”Due_x0020_Date”/>
<FieldRef Name=”ID”/>
</OrderBy>
<Where>
<And>
<Eq>
<FieldRef Name=”Status”/>
<Value Type=”Text”>Open</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name=”Author”/>
<Value Type=”Integer”>
<UserID Type=”Integer”/>
</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name=”CC”/>
<Value Type=”Integer”>
<UserID Type=”Integer”/>
</Value>
</Eq>
                              <Membership Type=”CurrentUserGroups”>
                                   <FieldRef Name=”CC”/>
                              </Membership>
</Or>
</Or>
</And>
</Where>
</Query>

Source: SharePoint Online: Filter items created by user or group of user in custom list – Anh Vo

Posted on Leave a comment

Sharepoint List View for group

  1. Adam – Admin, Full Control
  2. Betty – Accounts, Edit
  3. Cath –  Accounts, Edit
  4. Dom –  Marketing, Edit

At the moment, i have 2 views on my list. My Tickets and All Items. With some list permissions as well as using the [ME] filter and Target Audience, i am able to get users to see their own tickets. Clicking on All Item will take them to a blank page (Admin only via Target Audience) which has a link to redirect them to My Tickets

Here’s the fun part. Is there a way for me to create another view that would allow members of the Accounts group to see tickets raised by anyone in that group? For example If Betty raises a ticket, Adam (Admin) and Cath should be able to see and edit but not Dom since he is in a different group

Is that doable?

  • I found a way to actually filter a view by group. This will require SP Designer 2013

    1. Create a new view and filter Created By to [ME]
    2. Go to the newly created view and edit
    3. Look for <where> and replace with the entire line as below

    <Where><Or><Membership Type=”SPGroup” ID=“8”><FieldRef Name=”Author”/></Membership><Eq><FieldRef Name= “Author”/><Value Type=”Integer”><UserID Type=”Integer”/></Value></Eq></Or></Where>

    you will need to change the ID number to from group ID number. You can find that from the url link if you go the group in SharePoint. Something along the lines of Group Membership ID

    After that, the view should show all the items created by anyone in the group

Source: Sharepoint List View for group