29.11.11

SPSecurityTrimmedControl – Possible Values for PermissionsString

Link to Edit Form

<SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="EditListItems">

    <div>
      <a onfocus="OnLink(this)" href="JavaScript:var options=SP.UI.$create_DialogOptions();
options.url='{$FORM_EDIT}&amp;ID={$ID}';
options.height = 600; options.width = 800;
void(SP.UI.ModalDialog.showModalDialog(options))">
       <img src="{$HttpVDir}/SiteAssets/edit_16.jpg" style="text-decoration:none;border:0px;width:16px;float:left" alt="Edit"></img>
      </a>
    </div>
    </SharePoint:SPSecurityTrimmedControl>

Link to View Form

 


  <SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewListItems" Width="16px">

  
      <a onfocus="OnLink(this)" href="JavaScript:var options=SP.UI.$create_DialogOptions();
options.url='{$FORM_DISPLAY}&amp;ID={$ID}&amp;ContentTypeID={$thisNode/@ContentTypeId}';
options.height = 600; options.width = 800;
void(SP.UI.ModalDialog.showModalDialog(options))">
        <img src="{$HttpVDir}/SiteAssets/open.gif"  style="text-decoration:none;border:0px;width:16px;margin-left:2px; margin-top:-3px" alt="View "></img>
      </a>
  
  </SharePoint:SPSecurityTrimmedControl>

 

Link to Version Form

<SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewVersions">

   
      <a onfocus="OnLink(this)" href="JavaScript:var options=SP.UI.$create_DialogOptions();
options.url='{$HttpVDir}/_layouts/versions.aspx?list={$List}&amp;ID={$ID}&amp;ContentTypeID={$thisNode/@ContentTypeId}';
options.height = 600; options.width = 800;
void(SP.UI.ModalDialog.showModalDialog(options))">

        <img src="{$HttpVDir}/SiteAssets/icon_version.png"  style="text-decoration:none;border:0px;width:16px;margin-left:6px" alt="View "></img>
      </a>

  </SharePoint:SPSecurityTrimmedControl>

 

XSLT Global Parameters

http://msdn.microsoft.com/en-us/library/ff806158.aspx

 

Security PermissionsStrings

image

XSLT Global Parameters Example

    <td>
        <a onfocus="OnLink(this)" href="{$FORM_EDIT}&amp;ID={$ID}&amp;ContentTypeID={$thisNode/@ContentTypeId}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">
            <xsl:variable name="titlevalue" select="$thisNode/@Title" />
            <xsl:value-of disable-output-escaping="yes" select="$titlevalue" />
        </a>
    </td>

 

 

http://msdn.microsoft.com/en-us/library/ff806158.aspx

18.11.11

Adding SharePoint 2010 PoweShell cmdlets to your PowerShell ISE

Comodo powershel snap-in, from http://www.harbar.net/archive/2010/05/03/adding-sharepoint-2010-poweshell-cmdlets-to-your-powershell-ise.aspx:

# creates a local user powershell ISE profile
if (!(test-path $profile ))
{new-item -type file -path $profile -force}

# opens it for edit
psEdit $profile

# copy the following into the new file and save it
cd 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration'
.\SharePoint.ps1
cd \

# now everytime you run powershell ise as the same user - it will load the SP cmdlets automatically on start up

17.11.11

Amazing SharePoint Search Query

Remember, at the and of query with _vti_bin/spsearch.asmx insert the magic { –}

 

string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.SpQuery'>" +
                     "<Query>" +
                    "<Context><QueryText language=\"en-US\" type=\"MSSQLFT\">SELECT Title, Path, Description, Write, Rank, Size FROM Scope() WHERE FREETEXT(DEFAULTPROPERTIES,'" +
                   TextBox1.Text + "') ORDER BY Rank --</QueryText></Context></Query></QueryPacket>";

15.11.11

Search foundation client object model

 

If you don’t understand, it's not for you

 

using (QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService())
                {

                    string url = @”http://moss/_vti_bin/spsearch.asmx”;

                    queryService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                    queryService.PreAuthenticate = true;
                    queryService.Credentials = new System.Net.NetworkCredential("user", "pass", "dom");
                    queryService.Url = url;

                    message.Text = queryService.Status();

                    string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.SpQuery'>" +
                      "<Query>" +
                     "<Context><QueryText language=\"en-US\" type=\"MSSQLFT\">SELECT Title, Path, Description, Write, Rank, Size FROM Scope() WHERE FREETEXT(DEFAULTPROPERTIES,'" +
                    TextBox1.Text + "') ORDER BY Rank --</QueryText></Context></Query></QueryPacket>";

                    XmlDocument xml = new XmlDocument();

                    object obj = queryService.QueryEx(qXMLString);

                    if (obj != null)
                    {
                        DataSet dtqueryResults = (DataSet)obj;

                        GridView1.DataSource = dtqueryResults.Tables[0];
                        GridView1.DataBind();
                    }


                    xml.LoadXml(queryService.Query(qXMLString));

                    resultsLabel.Text = xml.OuterXml;

               }

            }
            catch (Exception ex)
            {
                resultsLabel.Text = ex.Message;
            }

Hiding Menu Item

  1. Copy the core.js file from its default location at %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\1033, place it in the same folder, and rename as customcore.js file.

  2. Make the necessary changes in the customcore.js file by removing unwanted ECB menu items.

  3. To create the custom master page, make a copy of the default.master page and rename it as custom.master.

  4. In the custom master page, add the following line to render the customcore.js file:

    <SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/><SharePoint:ScriptLink language="javascript" name="customcore.js" Defer="true" runat="server"/>

  5. Save the custom.master page and upload it to the master pages gallery of the site. Then apply the custom.master page as the default master page for the site.

31.10.11

Redirect on Created Item : Rescue the new ID

 

jquery is the solution

 

var LIST_question = '{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}';

var ServerAddress = 'http://xxx/';

function submitQuestion()

    {

var title = new String($("#title").val());

var t = new String($("#question").val());

    t=t.trim();

if(t=="")

return;

    title=title.trim();

if(title=="")

return;

var lists = new SPAPI_Lists(ServerAddress) ;

//

var newItem = { Title :  title, BodyCopy : t};

var items = lists.quickAddListItem(LIST_question, newItem);

var id=-1;

if (items.status == 200)

    {

var rows = items.responseXML.getElementsByTagName('z:row');

if(rows.length ==1)

        {

var r = rows[0];

var id = r.getAttribute('ows_ID');

                window.location.href='DispForm.aspx?ID='+id;

        }

else

        {

                alert("Error: No row added");

        }

    }

else

    {

        alert('There was an error: ' + items.statusText);

return;

    }

}

7.6.11

Cambiare Logs Files Location

Set-SPDiagnosticConfig -LogLocation LogFileLocation


Esempio:
Set-SPDiagnosticConfig -LogLocation D:\Logs\SharePoint\


Impostazione attuale:
Get-SPDiagnosticConfig

28.2.11

Connettere SharePoint List ad Outlook con batch file

Supponiamo che a livello di dominio vogliate che tutti gli utenti abbiano in automatico outlook connesso ad una o più liste di SharePoint.

Crea batch e lancia su dominio aziendale

start iexplore.exe stssync://sts/?ver=version&type=folder-type&cmd=command-name&base-url=sts-url&guid=the-guid&site-name=site-friendly-name&list-name=list-friendly-name&list-url=list-url&user-id=uid

4.2.11

hyperlinks using XSL T

<a><xsl:attribute name="href">
<xsl:value-of select="LINK/@VALUE"/></xsl:attribute>
<xsl:value-of select="LINK"/>
</a>