Skip Ribbon Commands
Skip to main content

Phone: 1-813-283-1662  |  Download Our V-Card  

Ime-tech.com > Blog
IME-Tech Blog
August 10
The content type is part of an application feature.

​So..

I created a set of content types from a feature some for testing some for production.

Of course after "testing" was done, I wanted to nuke my test content type...

So I updated my feature, and redeployed it.

FAIL! content type "UserContentTypeTest" was still showing in the list of content type. Naturally I tried to go into the site settings and delete it... well that is when the problem started. 

!!!WARNING!!! what is being suggesting isnt supported by Microsoft... but it works.

After hours of searching for a way to progromatically nuke this content type. I went in and was looking @ the content database to see wht feature guid it was saying it was attached to. 

select * from ContentTypes
where Size > 16 and SiteId like '8FFC8D90-BADA-481F%' and ResourceDir like 'User Test ContentType%'

In doing so I saw the field "IsFromFeature"

Oh goody 

So a quick

select * from ContentTypes
where Size > 16 and SiteId like '%8FFC8D90-BADA-481F%' and IsFromFeature = 1 and ResourceDir like 'User Test ContentType%'

Had same record count,and decided to use the ContentTypeID instead of the string.

Update ContentTypes  set [IsFromFeature] = 0 where (sys.fn_varbintohexstr(ContentTypeId) LIKE '0x010100212DC4BEF54C9C4CBA356B32827C7F76%')

Done!


I have since seen other posts with people saying they have had to go the same rout to fix the problem.

July 25
SPFarm: Object reference not set to an instance of an object
SPFarm.Local – Object reference not set to an instance of an object
So I was tasked with looping through all the sites on a farm to remove the "NT Authority\Authenicated Users" login from permissions, as I was writing a console application( to be later rolled into a windows services application ) I kept getting “Object reference not set to an instance of an object” when using the SPFarm.Local object.
 

SPFarm theFarm = SPFarm.Local; 

The solution was putting the “Platform Target” configuration of my console application from x86 to x64 or Any CPU:
platform target

 

After changing this, recompiled and poof working. Seriously the platform target gets far too often...​

February 11
SharePoint 2010 Web Part Title Wrapping

The Problem

SharePoint 2010 List Views and Web Part titles are wrapped in the HTML nobr (or no break) tag by default. Because this tag exists in the template, titles that are to wide for their designated content areas will not wrap. In most cases this will either break the width of the containing div, or create a scrollbar if the container is set to overflow: auto;

One solution that has been suggested is to include an empty content editor web part somewhere within the page that contains the white-space property. This solution not only doesn't work (because styles cannot remove html tags, and we need to delete or format the nobr tag), but would also be a clunky, inefficient way to resolve the issue (in our case, the client needed to be able to add and edit web parts themselves).


A Partial Solution with CSS

After further inspection, a partial solution was found using CSS to target the nobr tag itself.

Example:

.ms-standardheader .ms-WPTitle nobr span {
white-space: pre-wrap;
word-wrap: break-word;
word-spacing: normal;
letter-spacing: normal;
text-align: left;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px; }

Strangely, this method works on List View titles, but not in Web Part titles (such as content editors, content queries, etc.). So, this did not provide the complete solution we were looking for.


Problem Solved Using Javascript

Finish Solution Here

October 17
Overriding the Core CSS with Custom Styles

Creating custom CSS styles to override classes in the Core stylesheet can quickly become a debugging nightmare. Though SharePoint Designer offers a number of great features for finding and changing styles, many of these tools create "inline" styles that would need to be applied to individual objects in every instance.

Most interface and masterpage styles should be applied using a custom stylesheet to streamline the front-end development of a site and to make the process of applying changes site-wide a simple one.


SharePoint 2010 CSS Hierarchy

SharePoint 2010 uses complex nesting of CSS classes to allow for numerous stylistic options (which in many cases offers more options than are necessary). If you are using core classes and styles, you will want to get used to taking advantage of various tools to find and copy existing classes to your custom file.

Save Time with Tools

To save time and effort searching for classes or styles, I often open the existing SharePoint site in Firefox to make use of the all-too-handy FireBug addon. This tool allows you to quickly see both the HTML or CSS and to find the styles associated with a specific block of code.

Once those classes have been inspected, you can take them back into SharePoint Designer and use the Find tool to search for any instances of the class (or classes) in the Core stylesheet.

This step is very important because in nearly all cases, the styles will be used multiple times within the Core file. If a single case of a class-use is missed, you may spend an immense amount of time trying to debug your custom code.

In most cases, when your custom CSS is not properly overriding the Core styles, it is being caused by a very specific instance of a style having been missed.

Missing the Parent Container:

In the following example, the Core SharePoint Navigation for only the menu-item class is being specifically overwritten by our custom styles.

.s4-tn li.static > .menu-item {
color: #4a4235;
white-space: normal;
border: 0 none;
padding: 0px 30px 0px 0px;
display: inline-block;
height: auto;
vertical-align: middle;
font-family: Helvetica, Verdana, sans-serif;
font-weight: normal;
text-decoration: none;
font-size: 14px;
background-image: none;
background-color: transparent;
text-transform: uppercase; }

If this same class is written even slightly differently, it can cause a plethra of problems. For example: If you miss the .s4-tn container class and only target .menu-item styles, your CSS will affect both the Global Navigation and the Quick Launch (as they share the same inner menu classes).

In order to target a specific navigation separately you have to first designate the parent container (which in this case is .s4-tn).

Missing Multiple Instances of a Class

.s4-tn {
padding: 0px;
margin: 0px; }
.s4-tn ul.static {
white-space: normal; }
.s4-tn li.static > .menu-item {
color: #4a4235;
white-space: normal;
border: 0 none;
padding: 0px 30px 0px 0px;
display: inline-block;
height: auto;
vertical-align: middle;
font-family: Helvetica, Verdana, sans-serif;
font-weight: normal;
text-decoration: none;
font-size: 14px;
background-image: none;
background-color: transparent;
text-transform: uppercase; }
.s4-tn li.static .selected {
color: #b4a396;
font-weight: normal;
text-decoration: none;
text-transform: uppercase;
font-size: 14px;
background: transparent none;
font-family: Helvetica, Verdana, sans-serif; }

In the above example, you will see multiple instances of the .s4-tn and .static classes. Though in most cases, .s4-tn li.static .selected could also be written as .s4-tn .selected (for example) in this case, if your custom style does not define all three containers (or levels), it will not fully overwrite the Core styles.

Specifying CSS Properties

The same hierarchy applies to specific CSS properties. In the following example, the font-family for the entire global navigation is being defined in the top-most container.

.s4-tn { font-family: Tahoma, Verdana, sans-serif; }

However, this style may not affect the navigation completely. For example, a more specific instance of the font-family property might be assigned to the .static class of the list element within the navigation.

.s4-tn li.static { font-family: Helvetica, sans-serif; }

Conclusion

In order to fully define custom styles that are not conflicted by existing Core styles, it is imperative to define your custom styles in the correct order to all existing instances of a class, with the proper sequence of selectors and with the specific properties defined.