Tech Space

The Technical Solution Space for SharePoint 2010, MOSS 2007, and .Net (C#, VB.Net)

When you browse a PDF file , by default open in same window. Now you want to change the default behaviour to open it in separate window.

Solution:
PDF has the setting enabled. You can disable that setting.

Steps:
1. Open Acrobat Reader on you PC
2. Go to View > Preferences
3. Select 'Internet' from left side
4. Uncheck 'Display PDF in Browser' option

Note: This setting is a client side setting and all the above steps need to be followed on client machine which ever want to change the default behaviour.


























SharePoint Group

Active Directory Group

Members of this group can be added/removed from within SharePoint. The
permission to add or remove users from the group can be delegated to SharePoint
users.

Members of this group can be managed within Active Directory. Only Active
Directory administrators have the permission to modify group memberships.

Members of this group can be visible to users.

Members of this group are not visible to users.

Cannot contain another SharePoint group as member.

Can contain another Active Directory Group.

Must have a unique name on site collection level. The name is the unique
identifier of the group.

Can cause serious problems in lage scale scenarios: A user might only be a
member of 1024 Active Directory groups (recoursively). If this number is reached
the user is no longer able to log on to Windows.

Read the
Microsoft documentation for more information.

Can contain SharePoint users that do not exist in the Active Directory.

If you set Current Navigation to “Display the same navigation items as the parent site” and if you don’t find the same navigation items as of the parent site, you might need to add an EnableInheritance="True" attribute to the

PublishingNavigation:PortalSiteMapDataSource as in this example:

SiteMapProvider="CurrentNavSiteMapProvider"
EnableViewState="true"
StartFromCurrentNode="true"
StartingNodeOffset="0"
ShowStartingNode="false"
TrimNonCurrentTypes="None"
EnableInheritance="True"/>

SPFieldMultiLineText sampleField = sampleListItem.Fields["Sample"] as SPFieldMultiLineText;

string sampleText = sampleField.GetFieldValueAsText(sampleListItem["Sample"]);

//


// Returns the value of an Url-Field.
//


public static string GetFieldValueUrl(this SPListItem item, string fieldName)
{
if (item != null)
{
SPFieldUrlValue urlValue = new SPFieldUrlValue(item[fieldName] as string);
return urlValue.Url;
}
else
{
return string.Empty;
}
}

Example:

// Get the url of a SPFieldUrl field
string url = item.GetFieldValueUrl("URL");



//
// Sets the value of an URL-Field.
//


public static void SetFieldValueUrl(this SPListItem item, string fieldName, string url, string description)
{
if (item != null)
{
item[fieldName] = new SPFieldUrlValue()
{
Description = description,
Url = url
};
}
}


Example:

// Set the url and description of a SPFieldUrl field
item.SetFieldValueUrl("URL", "http://www.TestSite.com", "Test' Blog");

///


/// Set the values of a Lookup-Field with multiple values allowed.
///


public static void SetFieldValueLookup(this SPListItem item, string fieldName, IEnumerable lookupValues)
{
if (item != null)
{
SPFieldLookup field = item.Fields.GetField(fieldName) as SPFieldLookup;

SPFieldLookupValueCollection fieldValues = new SPFieldLookupValueCollection();

foreach (string lookupValue in lookupValues)
{
fieldValues.Add(GetLookupValue(item.Web, field, lookupValue));
}
item[fieldName] = fieldValues;
}
}


Example:

//Set the value of a SPFieldLookup field with multiple values allowed

string[] values = {"Hamburg", "London" };
item.SetFieldValueLookup("MultiLookupFieldName", values);

///


/// Sets the value of a Lookup-Field.
///


public static void SetFieldValueLookup(this SPListItem item, string fieldName, string lookupValue)
{
if (item != null)
{
SPFieldLookup field = item.Fields.GetField(fieldName) as SPFieldLookup;
item[fieldName] = GetLookupValue(item.Web, field, lookupValue);
}
else
{
item[fieldName] = null;
}
}


Example:

// Set the value of a SPFieldLookup field

item.SetFieldValueLookup("LookupFieldName", "LookupValue");

//


// Returns the value of a Lookup-Field with multiple values.
//


public static IEnumerable GetFieldValueLookupCollection(this SPListItem item, string fieldName)
{
List result = new List();
if (item != null)
{
SPFieldLookupValueCollection values = item[fieldName] as SPFieldLookupValueCollection;

foreach (SPFieldLookupValue value in values)
{
result.Add(value.LookupValue);
}
}
return result;
}


Example:
// Read lookup values of a SPFieldLookup field with multiple values allowed

IEnumerable values = item.GetFieldValueLookupCollection("MultiLookupFieldName");

//


// Returns the Single Value of a Lookup Field.
//


private static string GetFieldValueLookup(this SPListItem item, string fieldName)
{
if (item != null)
{
SPFieldLookupValue lookupValue = new SPFieldLookupValue(item[fieldName] as string);
return lookupValue.LookupValue;
}
else
{
return string.Empty;
}
}


Example:
// Reads the value of a SPFieldLookup field
string value = item.GetFieldValueLookup("LookupFieldName");