A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Saturday, September 3, 2005

Sending email after submitting InfoPath form (without coding)

Q: I use InfoPath form to submit data to a database. My form is published in SharePoint. How can I send an email either to myself or to some one else right after submitting the form?


Why don't you use Infopath's built in functionality? You have created a data connection to submit data to database. Create another connection that will send an email to your account. In Tools > Submitting Forms > Rules, Add a new rule. Add action in this rule. Select "Submit using a data connection" in the actions drop down and select email connection in the "Data Connection" drop down.


--SSA

How can I hide "Issues" List Template from users?

Q: I want to hide "Issues" List Template from users. Is it possible?

When you click "Create" link in the navigation bar at the top you are shown templates for different lists including document and form libraries, contact, issues, tasks, events lists. Yes, you can hide a template by modifying the ONET.XML file. To hide the "Issues" list, follow these steps:

1. Go to this location:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSXML
2. Open ONET.xml file for editing and please back up the original file before making any changes.
3. You will find list definitions for different lists inside tag. Simply comment out the list definition that you don't want to appear in the CREATE page. Use tags to comment out the line. For example, the following line will hide the "Issues" list template on the CREATE page:
-->
4. Save the file and Restart IIS.
5. Remove tags to uncomment the line and make the list visible again.

Caution: If you remove a list template from the ONET file, your existing lists based on that template will also cease to work.

-SSA

How can I send email to the user who modifies the document?

spListItem["Modified By"] property gives you the name of the person who last modified the document.
Have a look at the following code. You can get file's URL in EventFileURL if you are using EventHandlerToolkit.

spFile = EventWeb.GetFile( EventFileUrl );
if (spFile.Exists)
{
spListItem = spFile.Item;
}
string strModifiedBy = spListItem["Modified By"].ToString();

and if you want to send an email, here is how you can do it. You can send email in OnDelete(), OnInsert(), OnUpdate(), etc

private void OnDelete()
{
    //Insert code here: capture the name of the person who modified the document
    //Send email
MailMessage msg;
  
SmtpMail.SmtpServer = "smtp.yourserver.com";
msg = new MailMessage();
msg.BodyFormat = MailFormat.Html;
msg.From =  currentWeb.Author.Email; //you can use hard code the sender here
msg.Subject = "File Deleted";
msg.Body = "File has been deleted";
msg.To = currentWeb.Users[strModifiedBy].Email;
SmtpMail.Send(msg);
    
}
-SSA

Friday, September 2, 2005

How to get a list of sites in SharePoint using .NET code?

Here is how you can get a list of sites. The following function will retrieve a list of sites from your main portal address. All site names will be written to a text file.
Function GetFolders(ByVal rootsite As String)
//rootsite contains your main portal address, for example,
http://myportal
Dim strSites As String = ""
Dim mysite As SPSite
mysite = New SPSite(rootsite)

Dim subSites As SPWebCollection = mysite.AllWebs

Dim i As Integer

For i = 0 To subSites.Count - 1

Dim lists As SPListCollection = subSites(i).Lists

Dim j As Integer

Dim siteurl As String

For j = 0 To lists.Count - 1

strSites = strSites & SPEncode.HtmlEncode(subSites(i).Title) & ": " & SPEncode.HtmlEncode(lists(j).Title) & vbCrLf

//Insert Check Rights code here!!!

Next

Next

Dim sw As StreamWriter = File.AppendText("sites.txt")

sw.WriteLine("[" & Date.Now & "]")

sw.WriteLine(strSites)

sw.Flush()

sw.Close()

MsgBox("File created successfully. See 'sites.txt'!")

End Function

Thursday, September 1, 2005

SPS 2003: How to access users in members web part?

SharePoint Tip


Audience: Beginners

Question: Members web part shows all the users in my site but when i click a user to see details, it asks for a password and after i enter my username and password, i am refused access to the user details. Why? I have admin rights in the site.
You must have at least "Reader" rights on the portal. It doesn't matter if you have admin rights in the site itself but if you dont have rights at the portal level, then you can not see user details in the members web part. Clicking on a user in the members webpart takes you to the personal site (public view) of that user and if you dont have atleast "Reader" rights on the portal then you can not access the personal site of any user. This question is frequently asked by new SharePoint users so next time, if you face this situation, ask you SharePoint administrator to give you rights at the portal level.



Good luck

-SSA


Monday, August 1, 2005

SPS 2003: Use FrontPage Themes in SharePoint Sites

You may have applied themes to the SharePoint sites before. It is important because you can give a different look and feel to the sites belonging to different departments. Some groups of users like colorful sites. SharePoint contains a list of excellent themes that one can use but did you know that you can use FrontPage themes in SharePoint sites? FrontPage has an excellent collection of themes and you can use those themes for your SharePoint sites.


1. Open your SharaPoint site in FrontPage.


2. Select Format > Theme.


3. Select a theme from the collection (Click the down arrow to see options).


4. From the context menu, select "Apply as default theme".


5. A warning message will be displayed, click "Yes".


6. Check your site in browser.


-SSA

Thursday, June 16, 2005

SharePoint Server 2007 - Some Features

I attended "How Microsoft IT Plans SharePoint Capacity and Growth" Technet Webcast today. Following are some new features in SharePoint Server 2007 (taken from the webcast):

1. Infrastructure consolidation
> Co-hosting corporate and HostHeader mode sites in the same farm.
> Portals become site collections (fewer databases)
> No small/medium/large farm topology requirements

2. Full fidelity data protection
> Items, lists -> Recycle bin out of the box
> Webs, Sites -> Events that fire before the fact (SPEventReceivers)
> Benefit: Fewer database restores -> larger databases

3. Search
> Windows SharePoint Services: No SQL full-text search
> Common Office Server 2007/Windows SharePoint Services Search Engine

4. Life Cycle Management
> Site collection owner updatable by user
> Enable confirmation and auto deletion

4. Built-in page re-ghosting
> Fixes broken pages

5. Indexes on list columns

-SSA