Problem: Cant See all Content Type Fields when adding the Content Type to a SharePoint List

 

You might have faced this problem like me

Detailed Problem: When adding a content type to a list or a document library using the browser Interface, User cant see hidden fields neither in forms, views or even the list fields in list settings, and cant add them too, seems like they are added but cant be used in any way.

I honestly don’t know if this is a bug in SharePoint 2010, I searched online to find my same question but with no answer.

I noticed that this is a common problem when you have change fields properties to hidden in the main content type then you add the content type to the list and library.

Then I remembered my previous team leader saying when he told me, “GUI does not always listen to you, Command line is always more reliable”, he was talking about SharePoint PowerShell, but I decided to try it using C# code and it did work out.

So, the solution: in one word is CODING

And here is the Solution in details:

1- Go to your Target library and remove the content type out of it.

1- Navigate to your content type and change all hidden fields to optional, “don’t worry we’ll get them back to hidden later”.

2- Open Visual Studio 2010 and start a new console application (you really don’t need to start a SharePoint Application here!)

we’ll call it (FixHiddenFieldsIssue)

1

3-  First, add Reference to SharePoint dll to your project by Clicking right click on “References” to the right of your screen where you can see it under your project name

2

 

Under “.Net” tab, search for Microsoft.SharePoint and add it.

Note: if you cant find “Microsoft.SharePoint” dll make sure that your Project target framework is .NET framework 3.5 by navigating to your project properties.

5- Then add the Line (using Microsoft.SharePoint;”) before the namespace.

6- Now lets start coding:

static void Main(string[] args)
   {

//Connect to SharePoint Site
       SPSite TargetSite = new SPSite(“
<YOUR SharePoint SITE URL>“);
       SPWeb TargetWeb = TargetSite.OpenWeb();

//Get your List from the Site Lists

       SPList TargetList = TargetWeb.Lists[“<LIST NAME>“];

//If you did not enable it already from the advanced options of the list
       TargetList.ContentTypesEnabled = true;

//Get the Wanted Content type that you want to add to the List

       SPContentType ToAddContentType = TargetWeb.ContentTypes[“<CONTENT TYPE NAME>“];

//Add the Content Type to the List

       TargetList.ContentTypes.Add(ToAddContentType);

       TargetList.Update();
   }

7- Now build your project and run it.

8- after Checking your list on SharePoint and making sure content type is added and fields are shown, hide the fields you want to hide from library or list settings

 

Now you can finish your work without worrying about this problem. Hope that helped Smile.

SharePoint Saturday Jordan–Students Edition Presentation

 

314024_208382559221004_203056949753565_599285_636808_a

On the first of October, 2011 I had the honor to present at SharePoint Saturday Jordan – Students Edition. My presentation was all about “What is SharePoint”. I promised to Publish the slides back then so here I am doing it now.

 

Presentation Agenda:

– My story with SharePoint.

–  The Simplest definition of SharePoint

– SharePoint Wheel.

–  SharePoint Language: Farm, Application, Site Collection, Site, List, etc..

– Demo.

-Questions.

 

So, here are the presentation Slides link:

http://tinyurl.com/5u876bc

And here are the very easy videos that make you understand what SharePoint is, and I used them in My first two steps of SharePoint Baby Steps and my presentation

http://tinyurl.com/6ftdqwm

 

Hope you find them useful, have fun Smile

SharePoint Saturday Palestine, its not about SharePoint anymore

 

2011_SPS_Logo_Palestine (1)

 

My Arabic teacher in school used to say you make everything political, yes we all do, we are Palestinians! Smile I’m ganna do it one more time in this post:

When PSUG organized the first SharePoint Saturday back in September 2010, speakers from the USA came to join, like Paul Swider, Michael Noel, Joel Oleson and Michel Lotter (The Founder of SPS’s around the world). I had the honor of interviewing them all using my small video camera, the thing that interested me the most was the idea they were having about Palestinians which is based on media.

They were mostly shocked about how peaceful people we are, and most importantly how we have high awareness technically and up to every new around the world, so they changed the idea they had about us after knowing the truth.

The Nice thing that they went back to their countries and started to change other people’s Idea about the Palestinians there, I really respect them and appreciate what they did Smile .

So, to Me, SharePoint Saturday Palestine is Not about SharePoint anymore, its about proving that we are worth having such events, regardless of our circumstances and political situation, and we can keep up with all technical matters around the world just as same as other free countries. and the fact that there are some people that actually spent much of their effort, time and even money to make this happen is really proud driving.

That means contributing in such events as organizers, speakers, or even audience is not a matter of individual benefits anymore, it’s a matter of national image, and making the ICT sector a better one.

Tomorrow the great community is holding the forth SharePoint Saturday Palestine, here are the full Information’s of it:

http://www.sharepointsaturday.org/palestine/default.aspx

and the link on Facebook:

https://www.facebook.com/pages/SharePoint-Saturday-Palestine-SPSPal/115104495204814

and here is a small video I made last year about the first SharePoint Saturday Palestine:

So. I would love to thank everybody who helped making this event come true, see you there Smile

Workaround person or group field one value problem Using Nintex Workflow 2010

nintex2010

 

So I had this problem the other day at work and wanted to share it along with the way I solved it.

First of all lets talk about how things look like:

When you have a field in SharePoint of type “person or group” that takes already defined users on the active directory of the system, you can manipulate weather this field takes one value or multiple values by the field properties page. when you insert multiple values they will be automatically separated by a semicolon as the following:

User1; User2; User3….

10

the problem is weather this filed has one user or 10, system will consider whatever there is as one value! you can make sure of that by putting the field value in a variable for instance.

So what if I needed to check every user of those for a specific reason ?! here is what was my case:

Problem Case:

The scenario was that a user enters many users that are responsible for a specific task when creating it, and a workflow works on item creation should check if one of those users is on a vacation or not, if they are, they should be replaced by their replacement that are already defined in another list in the site called employees.

Solution:

I was lucky to be using Nintex for this customer, I’m sure same solution is doable on Visual Studio but I’m not sure if it is doable if you are creating your workflow over SharePoint designer.

So to me the solution was using the very traditional way: get the filed of users as a string, split it, put the splits in a collection and loop over them to check your condition, then get them back as a string again.

For testing purposes, I’m using a 30 days trial online SharePoint site from Nintex Company, as  you have to ask for users, I’m ganna replace one user statically within the workflow, you can make it as dynamic as you want based on your requirements.

So lets see:

1- What we have:

  • A Custom List named “Assigned Tasks” having 2 added columns: Assigned Users and Result Users

User Enters the assigned users in the field no matter how many they are and and you can see users after changes done on them on the field the “users after replacement”

“you can put result in the same field but this is to show the difference”

  • List Workflow named “replace vacation Users:” that works on creation and on edit.

2- Create all the Workflow needed variables as follows:

Variable name Type Show on start form
Users as text Single Line of Text No
Users as Collection Collection No
Temp User Single Line of Text No
Result Users Text Single Line of Text No
Replacement Single Line of Text No
Result Users People or group No

3- Now moving to build some workflow actions:

– put the value of the field “Assigned users” that end user entered in the variable “Users as Text” using the action “set field value”.

 2

Now we have a string, we will split it based on the semicolon between users “;”, use the action of “regular expression” with the option split as follows:

3

use the pattern “;#” to split the users coz that’s how SharePoint read them from active directory, save result in “Users Collection”

– Now add a “ for each” action to loop on all the collection, every loop needs a temp variable for the user that will be looped on, use the “temp user” variable for that as follows:”

4

– now add your wanted condition and apply it on the temp user “remember it’s a string now”

5

– Now if the condition applies, replace the value of “temp user” with the new value that you desire, in my case was the replacement name.

now lets build the all users string back: first add the semicolon back to the temp user using the “build string” action, save the new string (user1; ) in same variable “temp user” as follows:

6

– add this user to the rest of the users string (weather it is replaced or not it’s the same), doing this step in each loop will guarantee that the result users will be in same order. use the “build string again and add the temp user to the variable “Result Users Text” as follows:

7

store the result in the same “Result Users Text”

– Now, as “people or group” field does not accept text directly, we are ganna set the “Result Users Text” in a variable of type “people or group” then we will put this variable in the field of same type:

7

– And Last but not least, put the variable value back to the field “Users After Replacement”

8

Note: if your workflow showed and error you can hunt the errors easier by creating a field of type text, put the result in it and watch what it will be, as one more semicolon might ruin adding the string to the people field.

– Before saving and publishing your workflow, make sure it works on creation via workflow settings.

So lets see it in action:
manager starts a new task, enter the name and assigned users as the following (manager does not have to check if a user is on vacation or not).

1

In my case the accountant is on a vacation and the replacement is the field Engineer (as much as illogical that is!) anyway its only for testing purposes, after adding the new Item it will show up in list as follows:

10

and that’s it! user will be changed when workflow is completed.

Just for the record, Nintex is not paying me for this Smile with tongue out Hope that helped. Enjoy Smile

PSUG Monthly Session, SharePoint Integration with Oracle

 

IMG_0010

This Month’s Session for Palestinian SharePoint User Group was about SharePoint Integration With Oracle, and how  to use Business Connectivity Services in Order to use SharePoint as an interface for other types of external databases.

IMG_0026

In SharePoint 2007, Business connectivity services was only reading data from Outer Databases such as Oracle and SQL, now in 2010 edition you can add and edit using SharePoint.

IMG_0012

You can use either SharePoint Designer or Visual Studio for Business Connectivity , in VS using a third party named BDC Meta Man. by Connecting to the wanted Database, Configure permissions, tables and records wanted.

IMG_0034

When Connection is done, an external content type is created, and external list will be created then to get data from that content type. then you can use the list as same as any other list in SharePoint (add, edit, delete, etc.) you also can set some rules such as cascading delete cases for example.

IMG_0058

 

the most important limitation about external lists is that you CANNOT create a workflow on those.

IMG_0062

You can also use SharePoint Powerful search engine to search content from external databases, set the rules of it and configure it and, we are done!. I loved the fact that some companies that have many software’s on different platforms  uses SharePoint Search engine because it can be attached to all those software’s databases and get results of all of them together.

 

IMG_0037  IMG_0068

IMG_0070

Come Join us next time Smile

 

PSUG Session, Office 365

IMG_0096

Yesterday, PSUG’s leader: Saed Shela Introduced the Beta Version on “Office 365” to the local community.

IMG_0108

The Session started with What is Office 365, the products included in it for End User, features and added value of it and benefits of Using it for Enterprise companies.

IMG_0102

Then Speaker moved to a live DEMO starting from creating a new account up to setting it for user Desktop and took the attendees in a tour around.

IMG_0103

Finally he talked about the Support, Helpdesk, Privacy and Security of the product, and the plans for pricing and licensing.

IMG_0131

Yes, its pretty cool to use for both Technical and none Technical people Smile

IMG_0138

Some Advantages like Co-Authoring (multiple authors at the same time on the same document), availability on multiple browsers and platforms , Using Lync and SharePoint are some of the features this new product has.

IMG_0154

If you care to know more visit Office 365 Site , you can create your own Beta Account form there.

Or visit Office 365 Facebook Page 

And if you care to attend such session visit our community page on Facebook: PSUG Page

You can also Download the Slides of the Session from HERE

Index for All Baby Steps

Baby Step

Title

Baby Step 1

First Steps to enter the SharePoint World.

Baby Step 2

What the Hell is SharePoint

Baby Step 3

The Wheel

Baby Step 3 (Arabic Version)

حلقة خدمات الشيربوينت

Baby Step 4

SharePoint Technologies Dependencies and Concepts

Baby Step 5

Is it MOSS, WSS, SharePoint Server or Foundation ?!

Baby Step 5 (Arabic Version)

التسمية الصحيحة للشيربوينت

Baby Step 6

SharePoint Installation

Baby Step 7

SharePoint Architecture

SharePoint 2010 For Students–Baby Steps (7)

 

SharePoint Architecture, Lets talk SharePoint Language

This blog’s goal (other than explaining SharePoint Architecture) is to simplify some variables and terms in SharePoint, that would be used in next posts, which means; from now on, we are going to talk SharePoint language;

Note: definition of terms is are not referenced to anybody or any site, they are written in my own words, it is not professional and maybe not same as Microsoft definition but my only goal here is to deliver the idea, if that was done it would be enough for me Smile

From My perspective and to make it seem easier I am going to classify the

hierarchal Levels into two categories, high level one and low level one

The high level one (which can be accessed only by administrator and includes some setting not necessarily SharePoint core ones, such as database, Active Directory, Networks and so on), this category level includes:

Image above explains how are these pieces related to each other to form a full system: 

Farm: You can consider it as a container for all servers you will be using including the network connecting them –how to set Servers in a farm and on what bases  is the Administrator’s job – which is a high level and won’t be explained in this post.

Server: I think I don’t need to explain what a server is, the difference in SharePoint that, the admin will decide which server will have what, as mentioned before, you need x64 hardware, at least Windows Server 2008 R2, you can find all other Prerequisites on Mohamed’s Blog here

Most beginners will deal with a term called “a single server farm” which means that all the system will be installed on one server, meaning if you installed SharePoint on your Laptop, you can call it a single server farm

Content Database: Is the Database keeping all the data of the contents of Site Collections and everything in them – site collection is defined later in the post –

Web Application: Although having a URL, application is a virtual term, which means you cannot see an application once you create it, application takes a port, security type and other parameters will be explained later.

“Once you install SharePoint, two applications will be automatically created, Central administration one (which admins will be able to handle all other applications, services, functionalities and features from) and a regular web application with a site collection to start from”

The other Terms when we go down the chart to smaller definitions will be considered in the low level category, they are:

 Site Collection: You can look at a site collection as a Site, but as a unique root site, that is a containerof other site or sites, so you can use all of site’s functionalities on a site collection

Site: A site is a unit of independent data, users and permissions, different sites can also be different in themes, templates and so on, each site can also be a parent of other site/sites and these sites can hold other sub-sites and so on. they also can contain lists, document libraries and pages, those will be defined next.

Document Library: Can be Considered as a container of documents (word, PowerPoint. Excel. PDF, etc.) But, it does not stop to that limit, you can add special parameters to define each document of those in order to help in classifying them and search for them, those parameters are called (metadata)

An Example of metadata for document would be like (name, author, date of creation, and any other field you would like to add)

List: Container of data that is structured in a customizable way according to need.

Lists are the most important storage units in SharePoint, most of Sites’ data is stored in them, and to be more specific, Document libraries are special type of lists. and because of their importance, we are going to define them in a little bit more detailed way:

Look at a list like a table of columns and rows, columns are called fields, as in excel sheets or any type of database, each field will have a type (text, number, date, etc.)

So when you insert data to those fields you will have records (horizontal rows in table), each record is called an item that have its special parameters.

Each Item has the ability to attach a document to it in an optional way.

So what is the difference between a document library and a list ?

Well, if you are lucky enough to use them you will notice that when adding a new Item to a document library, it is essential to start a new document (or upload one to the system) then you will see a form to add the metadata of that document. in case of adding a new Item to a list, you will add the metadata, and that would be enough, then you have the option to add (attach) a document or not.

So it means that a list can contain only data while a document library has to contain documents.

Other terms you will frequently hear:

View: A way to show data of a list or a library, or we can describe it as a way of reporting for data based on some conditions and filtering criteria, like: which user is viewing data, subject,date etc..

Web Parts: part of the page that provides a specific functionality with user interface and can be customized according to need, people knows them as widgets on famous sites. like a part showing today’s weather, or a part on the side to show your contact list and so on.

Page: page is where you can see It all, views of lists, Web Parts, texts, pictures, lets just describe it as the interface of data for the end user.

all pages of site are stored in a special Document Library called Pages Library, where it has all features of the Document Library Except that instead of Documents you will find site pages

Workflow: a set of actions on an item that can be predefined by creator an
d used to do changes as needed when needed. like action of sending email to admin when a user adds a new Item to list, this will happen each time an item is added and it is predefined by the admin to do so.

So lets put it all together:

a Farm has a set of servers (one or more)

A server that has SharePoint Installed on have one or more Web applications

a Web Application have one or more site collections

a site collection has one or more Sites

a Site has:

  • Sub-Site/Sites
  • Document libraries
  • Lists
  • Pages
  • Views of Lists and Document Libraries

Note: What you can view,create, edit, delete, etc. of those parts depends on your Permissions that were given to you by the administrator.

I know, I listed a lot of new Information at the same time, you will be able to get them in a better way when I start introduce them to you face to face in the next post and the coming posts Smile and surely nothing new can be fully understood without live examples,  so stay tuned.

you can check out all the previous posts for SharePoint Baby Steps here